LOCATE primary command

  • When you use the LOCATE primary command in an editor session or the Object List utility:
    • FM/Db2 moves the display to the row, or first column, that matches the search criteria.
    • To move to a particular row, specify the row number. You can specify a label to move to a row to which that label has previously been assigned.
    • To search for a particular column, specify either the column number (for example, #4), or part or all of a column name (for example, SAL). When you search for part or all of a column name, you can use one of the optional parameters to nominate the direction and starting point for the search. Where there may be ambiguity, use the FLD parameter to differentiate between a column name and a Db2® column number.
  • When you use the LOCATE primary command in Print Browse (3.11):
    • Positions a specified line number at the top of the display.

Syntax

Figure 1. FM/Db2 editor session
(1)
Notes:
  • 1 These forms of the locate command locate a column.
  • 2 These forms of the locate command locate a row.
Figure 2. Object List utility

1 Locate
2.1 row_num
2.1 col_num
2.1 
2.2.1  FLD string
2.2.1 string
2.2.1! NEXT
2.2.1 FIRST
2.2.1 LAST
2.2.1 PREV
2.2.1 
2.2.2.1! NEXT
2.2.2.1 FIRST
2.2.2.1 LAST
2.2.2.1 PREV
2.2.2.1  FLD string
2.2.2.1 string
Figure 3. Print Browse

1 Locate line_number
string
A column name, or part of a column name
#n
A valid reference to a column.
pos
An integer representing a character position within a long (>50 characters) character or graphic column.
n
The sequence number of a row.
label
The label of a labeled row. label may be a user or system label.
row_num
The number of the row you want to locate. The row number is shown in the prefix area (TABL display mode), or in the upper right of the panel (SNGL display mode). For example, the following command locates row number 23:
LOCATE 23
Note: The row number is not shown when data is displayed with the Object List utility.
col_num
The Db2® column number (specified as #n) of the column you want to locate. For example, the following command locates column #12:
L #12
label
An existing user-assigned or editor-assigned label, identifying the row that you want to locate. The label must start with a period (.) followed by one to four alphabetic characters (no numeric or special characters). Labels starting with the letter Z indicate an editor-assigned label. For example:

LOCATE .HERE locates a row marked with an existing label (.HERE)

L .ZLST locates the last row.

FLD
Indicates to FM/Db2 that the string (string) following the FLD keyword is the name or part of the name of the column you want to locate. For example, the following command locates the column named #ITEMS:
L FLD #ITEMS
(In this case, if you omit the FLD parameter, the command L #ITEMS results in an error as FM/Db2 expects the # symbol to be followed by a numeric Db2® column number.)
string
The name (or part of a name) of the column you want to locate. The string can occur anywhere in the column name. For example, both of the following commands locate a column named SALARY:
L SAL
L ARY
NEXT
This is the default setting. In TABL display format, the search for string starts at (but excludes) the column currently displayed on the left of the screen and scans right. In SNGL display format, the search for string starts at (but excludes) the column currently displayed at the top of the screen and scans down. For example, both of the following commands locate the next column whose name contains the string SAL:
L NEXT SAL
L SAL NEXT
FIRST
In TABL display format, the search for string starts at (but excludes) the first column for the Db2® object and scans right. In SNGL display format, the search for string starts at (but excludes) the first column for the Db2® object and scans down. For example, both of the following commands locate the first column whose name contains the string SAL:
L FIRST SAL
L SAL FIRST
LAST
In TABL display format, the search for string starts at the last column for the Db2® object and scans left. In SNGL display format, the search for string starts at the last column for the Db2® object and scans up. For example, both of the following commands locate the last column whose name contains the string SAL:
L LAST SAL
L SAL LAST
PREV
In TABL display format, the search for string starts at the column currently displayed on the left of the screen and scans left. In SNGL display format, the search for string starts at the column currently displayed at the top of the screen and scans up. For example, both of the following commands locate the previous column whose name contains the string SAL:
L PREV SAL
L SAL PREV
line_num
The line number you want positioned at the top of the display.

Availability

Related tasks