FIND primary command
The FIND primary command searches the data for a character string or a numeric field with a particular numeric value.
In a File Manager/Db2 editor session, or the Object
List utility:
- 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 (even when you specify FIRST, LAST, PREV, NEXT, EX, NX, or X). To turn off the highlighting, enter the RESET FIND command.
In Print Browse:
- If the character string is found, the record containing the string is displayed at the top position.
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:
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.Syntax
- * (asterisk)
- Uses the search string specified on the previous FIND command as the search string.
- string
- The string you want to search for. The string, that can be up
to 100 characters in length, can be:
- A character string not starting or ending with a single 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
, andBLACK
:FIND black
- A character string enclosed in single 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 matchC'exact string'
. - 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'.' #3
- Find invalid character in columns 3.
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'¬' #2
- Find non-blank character in column 2.
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 single quotation
marks. For example,
X'C1C2'
. - (FM/Db2 editor session only.) A numeric value (only when you limit the search by specifying column numbers, and only when the column being searched is a numeric column).
- A character string not starting or ending with a single 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
- NEXT
- This is the default setting. Causes the search to begin at the cursor location (if the cursor is within the data portion of the display) or the beginning of the first row displayed, and searches ahead to find the next occurrence of string.
- ALL
- Causes the search to begin at the top of the data and find all
occurrences of the string. Note: Not-selected rows that are hidden from display or represented by shadow lines are not processed by the FIND command, even when the ALL parameter is specified.
- FIRST
- Causes the search to begin at the beginning of the table and search ahead.
- LAST
- Causes the search to begin at the end of the table and search backwards.
- PREV
- Causes the search to begin at the cursor location (if the cursor is within the data portion of the display) or the beginning of the first row displayed, and searches backwards to find the string.
- CHARS
- Matches the search string anywhere in the data.
- 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.
- #ALL
- Each column is searched according to its template attributes.
- col_num
- The Db2® column number (specified as #n) of a column to be included in the data search. Multiple column numbers must be separated by a comma or, if enclosed in brackets, separated by a blank or comma.
- col_num_1
- The first field reference of a range of fields. It cannot be subscripted. If the col_num_1 field reference value is less than the lowest displayed field reference value, the lowest displayed field reference value is used.
- col_num_2
- The last field reference of a range of fields. It cannot be subscripted.
If the col_num_2 field reference value is
greater than the highest displayed field reference value, the highest
displayed field reference value is used.
The col_num_1 and col_num_2 field reference values must be separated by a hyphen (-). Spaces are permitted between the hyphen and the field reference values.
If col_num_1 is a higher value than col_num_2, the search process reverses the operands.
- label1
- (FM/Db2 editor session only.) Label identifying the start of a range of rows. 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
- (FM/Db2 editor session only.) Label identifying the end of a range of rows. 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.
- EX
- Excluded rows only.
- NX
- Non-excluded rows only.
- X
- Same as EX.
Availability
- Table Browse panel
- Table Edit panel
- Table View panel
- Any Print Browse display panel
- Collections panel
- Columns panel
- Databases panel
- Database Request Modules panel
- Distinct Types panel
- Functions panel
- Indexes panel
- Application Packages panel
- Application Plans panel
- Schemas panel
- Stored Procedures panel
- Synonyms panel
- Tables, Views and Aliases panel
- Table Spaces panel
- Triggers panel
- Storage Group(s) panel