FIND/FX primary command

The FIND command finds occurrences of a string or value.

The FIND command can be entered using any abbreviation of the command (for example, F or FI), or by entering the forward slash ("/") character.

For date and time fields that are displayed using the output format defined in the template, File Manager searches the displayed values for the string specified with the FIND command.

The FX command (only available in View, Edit and the Find/Change Utility) displays an Extended Command Entry panel, in which you can enter long arguments that may not otherwise fit within the Command line (see Handling long strings in FIND for more information).

Multiple (& or AND) and (| or OR) operations are evaluated strictly left to right, but AND and OR may not be mixed in the same FIND statement. There is no operator precedence, and parentheses cannot be used to change the order of evaluation.

Syntax

FIND command in View or Edit

In View and Edit, the FIND primary command searches the data for a character string or (SNGL or TABL display format only) a numeric field with a particular numeric value. If the string or numeric value is found, then the FIND command positions the cursor at the beginning of the string or numeric field and, if necessary, automatically scrolls the found data into view.

The FIND command highlights all occurrences of the search string or numeric value in the entire data set. To turn off the highlighting, enter the RESET FIND command.

To find the next occurrence of the same string, press the RFind function key (F5), enter FIND *, or enter the FIND command with no parameters. A message is displayed if the string cannot be found.
Note:
  1. When you enter the FIND primary command in the Editor without specifying any parameters, File Manager displays the Extended Command Entry pop-up panel to allow you to enter arguments.
  2. FIND * does not repeat the previous FIND command with the same parameters. FIND * repeats the previous FIND command with the same string argument, but all other parameters revert to their default values unless specified.
  3. If you use the FNot version of the command, then a string is matched if it does not match according to the matching criteria described in this section.

For details on limiting the columns, fields or records searched by the FIND command, see Limiting the effect of editing changes.

When you are using View or Edit, the syntax of the FIND primary command is:
Figure 1. Syntax in View or Edit

1 Find
1 ∕
1 FX
1 FNot
1 FNX(1)
column range (all display formats)

1 col1 ?col2
field list or range (SNGL or TABL display format)

1 ! #ALL
2.1 (?+ , ref)
1 (?+ , ref_1 - ref_2)
label range (Edit only)

1!  .ZFIRST .ZLAST
1?  label1 label2
Notes:
  • 1 You can specify parameters in any order.
FIND command in FCH Utility

In the Find/Change Utility, the FIND command searches contents of the selected data set or data set members. If a matching string is found, the results are displayed on screen in a report showing the member names and record numbers where the string was found, and the list of selected members is reduced to only those containing a match.

When you are using the Find/Change Utility, the syntax of the command is:

Figure 2. Syntax in the Find/Change Utility

1 Find
1 ∕
1 FX
2 string
1  %OR clauses
1  %AND clauses
1! CHARs
1 PREfix
1 SUFfix
1 WORD
4? col1?col2
OR clauses

1 + 
2.1 |
2.1 OR
1string
AND clauses

1 + 
2.1 &
2.1 AND
1string

Related topics

FIND command in Catalog Services: Data Set List, Display VTOC Data Set List, AFP Browse and Memory Browse

In the Catalog Services: Data Set List or Display VTOC Data Set List panels, the FIND command searches the list of data set names. If an entry name containing a matching string is found, the list is scrolled to display the matching data set at the top position. The Display VTOC Data Set List panel allows for a string argument which may contain the * and % wildcard characters. The FIND argument is matched against the data set names using the default system match rules for such wildcard characters.

In the AFP Browse utility, the FIND primary command finds the next occurrence of a character string in the data you browse. If the character string is found in a data line, it is displayed at the top line and the cursor is positioned at the beginning of the string.

In the Memory Browse utility, the FIND primary command finds the next occurrence of a character string in the data you are browsing. If the character string is found, it is displayed at the top position. The Location field indicates the address. To find the next occurrence of the same string, use the RFIND command, or enter the FIND command with no argument. A message is displayed if the string cannot be found.

In the Catalog Services: Data Set List, Display VTOC, AFP Browse and Memory Browse panels, the syntax of the command is:

Figure 3. Syntax

1 Find
1 ∕
2 string
FIND command in member selection panels and the Load Module Information panel

In member selection panels, the FIND command normally finds the next occurrence of a character string in the member names being displayed, starting at the top of the displayed page or starting at the cursor position (if the cursor is within the data portion of the display). In the Load Module Information panel, the same rules apply to the list of entries shown on the display.

File Manager places the cursor at the beginning of the found string. If necessary, automatic scrolling is performed to bring the string into view.

Figure 4. Syntax - member selection and Load Module Information panels

1 Find
1 ∕
1 
2.1! NEXT
2.1 ALL
2.1 PREV
2.1 LAST
2.1 FIRST
2.1 string
1 
2.1 string
2.1! NEXT
2.1 ALL
2.1 PREV
2.1 LAST
2.1 FIRST
FIND command in selection lists

In selection lists, the FIND command finds the next occurrence of a character string in any column of the selection list being displayed, starting at the top of the displayed page or at the cursor position (if the cursor is within the data portion of the display).

The cursor is placed at the line containing the found string. If necessary, automatic scrolling is performed to bring the string into view.

Figure 5. Syntax - selection lists

1 Find
1 ∕
1 
2.1! NEXT
2.1 ALL
2.1 PREV
2.1 LAST
2.1 FIRST
2.1 string
1 
2.1 string
2.1! NEXT
2.1 ALL
2.1 PREV
2.1 LAST
2.1 FIRST
* (asterisk)
Uses the search string specified on the previous FIND command as the search string.
string
Search string, which must be no more than 100 characters long, or when used with,a Member Selection List, no more than the width of the member name column. The string can be:
  • No more than 100 characters long.
  • An empty string, that is, using FIND without specifying a string. The search string specified on the previous FIND, CHANGE, or EXCLUDE command is used as the search string. A FIND ALL with no search string specified performs a RESET FIND, turning off any highlighting from previous FIND, CHANGE, or EXCLUDE commands. Does not apply to member or WebSphere® MQ selection lists.
  • A character string not starting or ending with a quotation mark and not containing any embedded blanks or commas. The case of the string is ignored. Uppercase and lowercase representations of the same character match. For example, the following command finds the strings black, Black, and BLACK:
    FIND black
  • A character string enclosed in quotation marks. The string can contain blanks and commas. The case of the string is ignored. For example, 'Exact string' matches 'exact string'.
  • C followed by a character string enclosed in quotation marks (C'Frog'), or a character string enclosed in quotation marks followed by C ('Frog'C). The string can contain blanks and commas. The string must match exactly (including case). For example, C'Exact string' does not match C'exact string'.
  • A DBCS string or a mixed DBCS and non-DBCS string. A shift-out (X'OE')as the first character, or a shift-in (X'OF') as the last character, are discarded as part of the search string. (Not supported in the Catalog Services List or Display VTOC panels.) Does not apply to member or WebSphere® MQ selection lists.
  • P preceded or followed by a picture string enclosed in single or double quotation marks to describe a type of string to be found rather than the exact characters. It can contain blanks, alphabetic and numeric characters which represent themselves, or any of the special characters listed here, each of which represents a class of characters:
    =
    Any character.
    @
    Alphabetic characters.
    #
    Numeric characters.
    $
    Special characters.
    & notsym;
    Non-blank characters.
    .
    Invalid characters.
    -
    Non-numeric characters.
    <
    Lowercase alphabetics.
    >
    Uppercase alphabetics.

    Examples of picture strings used with the FIND command:

    find p'.' 73 80
    Find invalid characters in columns 73 to 80.
    find p'###'
    Find 3-digit number (for example, 101 but not 99).
    find '@1'p 1
    Find label a1,b1,c1, (and so on) in column 1.
    find p'<'
    Find lowercase alphabetic character.
    find p'¬' 72
    Find non-blank character in column 72.

    When this notation is used, numeric, bit and Unicode fields (for SNGL and TABL display formats) are excluded from the search process.

  • X followed by a hexadecimal string enclosed in quotation marks (X'C1C2'), or a hexadecimal string enclosed in quotation marks followed by X ('C1C2'X). Does not apply to member selection lists.
  • A numeric value (only when, in SNGL or TABL display format, you limit the search by specifying field references, and only when the field being searched is a numeric field). For details, see Searching numeric fields. Does not apply to member or WebSphere® MQ selection lists.
ALL
Searches forwards from the top of data. Same as FIRST, except that ALL also displays the total number of occurrences of string in the records searched.
Note:
  1. Suppressed or not-selected records that are hidden from display or represented by shadow lines are not searched, even when you specify ALL.
  2. The ALL parameter is recursive when used with the FIND command. That is, applying the command FIND ALL 'SS' to the string 'SSS' finds two occurrences, the first 'SS' and the second 'SS'.
  3. A FIND ALL command with no search string specified performs a RESET FIND command, turning off any highlighting from previous FIND, CHANGE, or EXCLUDE commands.
EX
Excluded records only.
FIRST
Searches from the top of data for the first occurrence of string.
LAST
Searches backwards from the bottom of data for the last occurrence of string.
label1
Label identifying the start of a range of records. 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.
label2
Label identifying the end of a range of records. 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.
NEXT
Searches forwards from the cursor position (if the cursor is within the data portion of the screen), or from the beginning of the topmost record displayed on the screen, for the next occurrence of string.
NX
Not-excluded records only.
PREV
Searches backwards from the cursor position (if the cursor is within the data portion of the screen), or from the beginning of the topmost record displayed on the screen, for the next occurrence of string.
PREFIX
Matches the search string wherever it appears as a prefix in the data. To be a prefix, the matched text must be preceded by a non-alphanumeric character or be the start of a line or field, and must be followed by an alphanumeric character.
SUFFIX
Matches the search string wherever it appears as a suffix in the data. To be a suffix, the matched text must be preceded by an alphanumeric character, and must be followed by a non-alphanumeric character or be the end of a line or field.
WORD
Matches the search string wherever it appears as a word in the data. To be a word, the matched text must be preceded by a non-alphanumeric character or be the start of a line or field, and must be followed by a non-alphanumeric character or be the end of a line or field.
col1
The first column to be included in the range of columns to be searched. Must be greater than or equal to 1, and less than or equal to the maximum record length. When column ranges are specified and the data is displayed in SNGL or TABL formats, the search is performed in the order that the data occurs, which may not be the order in which the fields are displayed.

When column ranges are specified in SNGL or TABL display format, then a string comparison is performed, even for numeric fields.

Note: When you use the FIND primary command in the Find/Change Utility, if the JCL Source format option is selected, the columns searched are set to 3 through 71, unless the statement is not a JCL statement. A statement is considered to be a JCL statement if it begins with the strings "/*" or "//". If the statement does not begin with either of these strings, it is not considered to be a JCL statement in which case any column range specified on the FIND (or CHANGE, respectively) command or preset using the BOUNDS command is honored. If no column range has been specified, the full record is searched.
col2
The last column to be included in the range of columns to be searched. Must be greater than or equal to col1 and less than or equal to the maximum record length.

In the Editor, if col2 is not specified, it defaults to the value of col1, creating a search range of one column.

In the FCH Utility, if col2 is not specified, it defaults to the record length, creating a search range from col1 to the end of the record.

#ALL
Each field is searched according to its template attributes.
ref
A field reference, specifying the field to be included in the search, for example: #3.

When the field is an array, to search all items in the array, simply specify the field reference without a subscript. To search an item in a single-dimension array, specify a subscript in parentheses to identify the occurrence that you want to find; for example: #5(3). If your field is part of a multi-dimensional array, you must specify a subscript for each dimension in the array; for example: #7(2,3).

Multiple field references must either be enclosed in parentheses, or separated with commas but without any intervening spaces. For details, see Limiting the search to specified fields.

In SNGL or TABL display format, if you specify field references or do not specify a field reference or column range, when searching a numeric field, the search string is interpreted as a numeric value, and a numeric comparison is performed. When searching a character field, a string comparison is performed. That is, the search is performed based on the File Manager template attributes. For details, see Searching numeric fields.

ref_1
The first field reference of a range of fields. It cannot be subscripted. If the ref_1 field reference value is less than the lowest displayed field reference value, the lowest displayed field reference value is used.
ref_2
The last field reference of a range of fields. It cannot be subscripted. If the ref_2 field reference value is greater than the highest displayed field reference value, the highest displayed field reference value is used.

The ref_1 and ref_2 field reference values must be separated by a hyphen (-). Spaces are permitted between the hyphen and the field reference values.

If ref_1 is a higher value than ref_2, the search process reverses the operands.

X
Same as EX.

Availability

Related tasks and examples