FIND command
The FIND
command provides full-screen and line
mode search capability in the source object, and full-screen searching
of the log and monitor objects.
- string
- The string you want to find, which conforms to the syntax for
a character string constant of the current programming language. The
string must comply with the following restrictions:
- The length of the string cannot exceed 128 bytes.
- If the string contains spaces, or is an asterisk (*), a question
mark (?) or a semicolon (;) it must be enclosed in quotation marks
(") or apostrophes (') as described in the following rules:
- For C and C++, use quotation marks (").
- For COBOL, LangX COBOL, assembler, disassembly, or
PL/I, use quotation marks (") or apostrophes (').
Table 1. Examples of how to specify quotation marks (") and apostrophes (') for strings in a FIND command. C C++ COBOL or LangX COBOL Assembler or disassembly PL/I "ABC" "IntLink::*" "A5" or 'A5' 'ABC' or "ABC" or C'ABC' 'ABC' or "ABC"
- If the string contains a quotation mark (") or apostrophe ('),
you might have to specify the string with an even number of quotation
marks or apostrophes (also known as balance). Use the
following rules to determine how to balance the string:
- For PL/I, if the string has an apostrophe, you must add an apostrophe immediately following that apostrophe. If the string contains a space, surround the entire string with apostrophes.
- For C and C++, if the string has a quotation mark, you must add a quotation mark immediately following that quotation mark. If the string contains a space, surround the entire string with quotation marks.
- For assembler, COBOL, LangX COBOL, or disassembly, if the string contains an apostrophe and it is delimited by apostrophes, you must add an apostrophe immediately after the apostrophe that is in the string. If the string contains a quotation mark and it is delimited by quotation marks, you must add a quotation mark immediately after the quotation mark that is in the string. If the string contains a space, you do not have to balance the quotation marks; however you must surround the entire string with a quotation marks or apostrophes.
If no operands are specified, a repeat FIND is performed. The usage notes and IBM® z/OS Debugger User's Guide describes repeat FIND.
- *
- Use the string from the previous
FIND
command. - leftcolumn
- A positive integer that specifies the leftmost column for the search. This is supported only in the Source window and in line mode. It is ignored in the Log and Monitor windows. If rightcolumn and * are omitted, then the string must start in leftcolumn.
- rightcolumn
- A positive integer that specifies the rightmost column for the search. This is supported only in the Source window and in line mode. It is ignored in the Log and Monitor windows.
- *
- Specifies that the length of each source record is used as the right column for the search. This is supported only in the Source window and in line mode. It is ignored in the Log and Monitor windows.
FIRST
- Starts at the beginning of the object and searches forward to find the first occurrence of the string.
LAST
- Starts at the end of the object and searches backward to find the last occurrence of the string.
NEXT
- Starts at the first position after the current cursor location and searches forward to find the next occurrence of the string.
PREV
- Starts at the current cursor location and searches backward to find the previous occurrence of the string.
CURSOR
(Full-Screen Mode)- Specifies that the current cursor position selects the object searched.
LOG
(Full-Screen Mode)- Selects the object in the session log window.
MONITOR
(Full-Screen Mode)- Selects the object in the monitor window.
SOURCE
(Full-Screen Mode)- Selects the object in the source listing window.
Usage notes
- If no operands are specified, a repeat FIND is performed. A repeat
FIND behaves in the following ways:
- The string from the previous FIND that you entered is used.
- If no FIND string has been previously specified, z/OS® Debugger displays an error message.
- If the previous
FIND
command that you entered specified or implied theFIRST
orNEXT
parameter, z/OS Debugger uses theNEXT
parameter. - If the previous
FIND
command that you entered specified theLAST
orPREV
parameter, z/OS Debugger uses thePREV
parameter. - If the previous
FIND
command that you entered specified a leftcolumn parameter, z/OS Debugger uses that leftcolumn parameter. - If the previous
FIND
command that you entered specified a rightcolumn parameter, z/OS Debugger uses that rightcolumn parameter. - If a repeat FIND immediately follows an unsuccessful FIND or repeat FIND, z/OS Debugger continues searching, wrapping from the last line to the first line. If the original direction of the FIND was backward to the beginning of the object, z/OS Debugger wraps from the first line to the last line.
- If the cursor is not in a window, z/OS Debugger uses the same window that was used for the previous FIND command.
- In full-screen mode, z/OS Debugger chooses
the window it searches through in the following ways:
- If you specify a string and you do not place the cursor in a window
nor specify an object on the command, z/OS Debugger searches
the object in the window specified by the
SET DEFAULT WINDOW
command or the Default window entry in your Profile Settings panel. - If you place the cursor in a window and do not specify a different window on the command, z/OS Debugger searches the object in the window where you placed the cursor.
- If you specify a string and you do not place the cursor in a window
nor specify an object on the command, z/OS Debugger searches
the object in the window specified by the
- If you specify a string without a direction keyword, forward is the default direction.
FIND
can be made immediately effective in full-screen mode with theIMMEDIATE
command.- If the current programming language setting is C or C++, the search is case-sensitive. Otherwise, the search is not case-sensitive.
- In full-screen mode, searches show the following behavior:
- If you specify
FIRST
, the search begins at the beginning of the first line of the object. - If you specify
LAST
, the search begins at the end of the last line of the object. - If you specify
NEXT
or the command defaults toNEXT
and the cursor is within the window for the object being searched, the search begins at the first position after the current cursor location. - If you specify
NEXT
or the command defaults toNEXT
and the cursor is outside the window for the object being searched, the search begins at the beginning of the first line displayed in the window. - If you specify
PREV
or the command defaults toPREV
and the cursor is within the window for the object being searched, the search begins at the current cursor location. - If you specify
PREV
or the command defaults toPREV
and the cursor is outside the window for the object being searched, the search begins at the end of the line preceding the first line displayed in the window of the object being searched. If the beginning of the object is displayed, z/OS Debugger wraps to the end of the object and continues from the end of the last line in the object. - If z/OS Debugger finds
the string, the window for the object being searched is scrolled until
the string is visible. If the string is DBCS, it is displayed without
alteration. If the string is not DBCS, the string is highlighted as
specified by the
SET COLOR
command and the cursor is placed at the beginning of the string. The highlighted string is protected from overtyping. If you need to overtype the string, press enter and place the cursor where you want to type and proceed with the overtype. - If z/OS Debugger does
not find the string, the screen does not change and the cursor is
not moved. If you specified
NEXT
orPREV
or the command defaults toNEXT
orPREV
and z/OS Debugger searched only part of the object, then z/OS Debugger displays the message 'Bottom of data reached' or 'Top of data reached', as appropriate. If z/OS Debugger searched through the entire object, then it displays the message 'Search target not found'.
- If you specify
- In line mode, searches show the following behavior:
- If you specify
FIRST
, the search begins at the beginning of the first line of the source. - If you specify
LAST
, the search begins at the end of the last line of the source. - If you specify
NEXT
or the command defaults toNEXT
, z/OS Debugger begins searching at the first character of the first line of the source or, if a previousFIND
command was done in the same compile unit, at the location after the last string that was successfully found by aFIND
command. - If you specify
PREV
or the command defaults toPREV
, z/OS Debugger begins searching at the last character of the last line of the source, or if a previousFIND
command was done in the same compile unit, at the location before the last string that was successfully found by aFIND
command. - If you specify
NEXT
orPREV
or the command defaults toNEXT
orPREV
and z/OS Debugger searched only part of the source and did not find the string, then z/OS Debugger displays the message 'Bottom of data is reached' or 'Top of data is reached', as appropriate. If z/OS Debugger searched through the entire source without finding the string, then it displays the message 'Search target not found'. - If z/OS Debugger finds the string, the line that contains the string is displayed and marked with a vertical bar character (|) beneath the string.
- If you specify
- The search in the Source window and in line mode can be limited
to certain columns by choosing one of the following methods:
- If you enter a pair of column numbers indicating the first and last columns to be searched, the string is found if it is completely contained within the specified columns.
- If a single column is specified, the string must start in the specified column.
- If the second column specified is larger than the record size, the record size is used.
- If the columns are not specified, the columns to be searched default
to the columns defined by the
SET FIND BOUNDS
command. If you have not entered theSET FIND BOUNDS
command, the columns default to 1 *.
The column alignment of the source might not match the original source code. The leftcolumn and rightcolumn specifications are related to the scale shown in the Source window, not the original source.
- The full-screen
FIND
command is not logged; however, theFIND
command is logged in line mode. - If you are searching for strings with trigraphs in them when debugging
C or C++ code, the trigraphs or their equivalents can be used as input,
and z/OS Debugger matches
them to trigraphs or their equivalents. An exception is that column
specifications other than 1 * are not allowed in
FIND
orSET FIND BOUNDS
if you search source code and trigraphs are found. - If you are searching in the monitor window and
SET MONITOR WRAP OFF
is in effect, z/OS Debugger will search all of the scrolled data. - You cannot use the
FIND
command in the Memory window.
Examples
- Indicate that you want to search the monitor window for the name
myvar
.FIND myvar MONITOR;
- If you want to search the Source window for the next occurrence
of
var1
, just enter:
You do not need to provide the variable name, because the z/OS Debugger remembers the string you last searched for. Again, the Source window is scrolled forward,FIND
var1
is highlighted, and the cursor points to the variable. - If you want to find a question mark (?) in the Source window and
you are debugging a PL/I program, enter the following command:
FIND '?' ;
- If you want to find the string
User's
in the Source window and you are debugging a PL/I program, enter the following command:FIND User''s ;
- If you want to find the string
User's
in the Source window and you are debugging a C program, enter the following command:FIND User's ;
- If you want to find the string
User's Guide
in the Source window and you are debugging a PL/I program, enter the following command:FIND 'User''s Guide' ;
- If you want to find the string
User's Guide
in the Source window and you are debugging a C program, enter the following command:FIND "User's Guide" ;
- If you entered the command
FIND xyz LAST;
orFIND xyz PREV;
and the cursor is on the found string ("xyz"), then press the PF key assigned to theFIND
command to repeat the search. z/OS Debugger runs the commandFIND xyz PREV;
. - If you entered the command
FIND xyz;
, z/OS Debugger searches in the forward direction. To find the string "xyz" in the backward direction, enter the commandFIND * PREV;
. - If you want to find a COBOL paragraph definition named
paraa
that starts in column 8 in COBOL’s Area A, enter the following command:FIND paraa 8 ;
- If you want to find a reference to a COBOL paragraph named
paraa
in COBOL’s Area B, then enter one of the following commands:FIND paraa 12 72;
-
SET FIND BOUNDS 12 72; FIND paraa;