FIND and RFIND
The FIND command is used to search for one or more occurrences of a character string. You can enter the operands in any sequence except that col-2 must follow col-1, and data-name or CURSOR must be the last operand in the command. Operands must be separated by one or more blanks.
The operands function the same for the FIND command as they do for the CHANGE command. For more information about the operands, see CHANGE-and-RCHANGE.
See here for information on how the FIND command is affected by non-keyed and nonunique segments.
PL/I
You cannot use the FIND command to find individual bit patterns within a BIT data item. For example, if a field is declared as BIT(8) and contains 11000101, a FIND 101 command does not find the 101 in bits five through seven of the field. However, because 11000101 is the bit pattern for the character E, a FIND E or FIND X’C5’ command successfully finds E in the Bit field1.
Repeat Find (RFIND)
The RFIND command is used to find the next occurrence of the designated string. The other optional parameters remain in effect as specified in the last FIND command.
If you press a PF key assigned to the FIND or CHANGE command, File-AID for IMS treats the command as RFIND or RCHANGE.
FIND Command Screen
The FIND Command screen is displayed when the FIND command is entered without any operands in the Command field of an Edit or Browse screen2.
FIND Command Screen
COMMAND ===>
Specify FIND operands:
Find string ===>
Segment name ===> (Blank for all segment types)
Modifier ===> (NEXT, ALL, FIRST)
Search range ===> (NORCD, RCD, CHILD)
Maximum calls ===> (0 = No limit)
Data-name ===>
or
Start column ===> End column ===> (Blank for default cols)
NOTE: You may bypass this screen by entering the FIND command with operands:
FIND string SEG(segment-name) (NEXT) (NORCD) GET(n) (col-1 (col-2))
F SEGM (ALL) (RCD) GN(n) (data-name)
SEGMENT (FIRST) (CHILD) (CURSOR)
(CUR)
(C)
Find String
Enter the string that you want to search for. For more information on string syntax, see CHANGE-and-RCHANGE.
Segment Name
Enter the name of the segment type to be searched. If you do not specify a segment type, all segment types are searched unless you specify a data-name. In this case, the segment type that you are currently positioned on is searched.
Modifier
Enables you to control the starting point and extent of the search. The following operands are valid:
NEXT | Starts the scan at the current cursor location and proceeds forward to find the next occurrence of the string. This is the default operand. |
ALL | Starts the scan at the top of the search range and proceeds forward to find all occurrences of the string. |
FIRST | Starts the scan at the top of the search range and proceeds forward to find the first occurrence of the string. |
Search Range
Allows you to control the range of the search. The following operands are valid:
NORCD | Searches the entire database. This is the default operand. |
RCD | Searches only the current database record. |
CHILD | Searches only the children of the current segment. |
Maximum Calls
Enter the maximum number of segments to be searched. 0 is the default value. If you leave this field blank or specify 0, there is no limit placed on the extent of the search. In this case, all database segments are potentially searched.
When the number of segments processed reaches the number specified in the Maximum Calls field, the FIND/CHANGE Message screen is displayed. See here for an illustration and description of this screen.
You can limit the search to a portion of each segment rather than the entire segment by specifying a data-name or column boundaries.
Data-Name
If you are in Formatted mode, you can specify a data-name that indicates the portion of the segment that corresponds to the field to be searched.
If you specify a data-name, it must exist in the current segment’s COBOL or PL/I layout. By specifying a data-name, the search is limited to the current segment type.
You can also use the CURSOR operand in place of a data-name. To do this, position the cursor on the data-name you want to limit the search to while in Formatted mode before you invoke the FIND command. When the FIND Command screen is displayed, enter CURSOR, CUR or C in the Data-Name field.
Start Column
Specify the starting position for the search.
End Column
Specify the ending position for the search. If you specify a Start column without an End column, the string must begin in the Start column to be found. If you specify both Start and End columns, the string does not need to begin in the Start column, but it must be completely contained within the boundaries to be found.