TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB Tools Articles Forum Quiz Interview Q&A

Find Command


Find Command in View/Edit:

FIND is most frequently used command in View, Edit, Browse. The FIND command has a lot of options, which are categorized as follows.

Find Command

The various categories may be used independent of each other. These options are to be given apart from the string to be searched. The search can be limited to a range of columns specified by the column numbers.

For example, FIND XYZ 23 45 finds the next occurrence of the string XYZ in the column range 23 to 45. If you specify only one column number (and not a range) then search will be for the string starting at the specified column. The labels that you set can be used to delimit the search range row-wise. If you give two labels, then the search is done in that range only. You cannot give a single label.

ISPF assigns a set of predefined labels for some lines. These are as follows:

  • .ZF:

    (.ZFIRST) for the first line of the data set.

  • .ZL:

    (.ZLAST) for the last line of the member.

  • ZCSR:

    (.ZCURSOR) for the current cursor position.

  • WORD:

    Indicates that the string to be searched for is delimited by spaces or non-alphanumeric characters.

  • CHAR:

    Indicates that the string need not be words.

  • PREFIX:

    Indicates that the string is followed by some other characters without intervening spaces. (that is, the string is a prefix).

  • SUFFIX:

    Indicates that the string is preceded by some other characters.

  • HEX:

    If the string is enclosed in single quotes and preceded by 'x', then it implies that the string is specified in Hex characters. The string should have only valid Hex characters and should have an even number of characters.

  • TEXT:

    Indicates that the string is to be searched for without matching the case, that is, the search is not case sensitive. Since this is the default, it is not used. The string is enclosed in quotes and preceded by 't'. CASE: If the string is enclosed in quotes and preceded by 'c', the search will be case-sensitive. For example, FIND C'ISPF runs on TSO'.

  • FIRST:

    Search for the first occurrence of the string.

  • LAST:

    Search for the last occurrence of the string.

  • ALL:

    Position the cursor at the first occurrence and display the number of occurrences at the top right corner.

  • PREV:

    Find the previous occurrence from the current cursor position.

  • NEXT:

    Find the next occurrence starting from the current cursor position. The string that was used for the previous.

  • FIND:

    Command can be used again by just specifying ''*'. If you issue FIND *, the system will find the next occurrence of the previous FIND string. The direction of the search will be the same as the direction of the previous FIND command. The defaults for the FIND are NEXT, .ZCSR .ZL, TEXT, CHAR.


A few examples of valid FIND command are:

STEP 1: Find between column.

Find Command between column

Find String 'find' between column 1 to column 10.

Result: Find between column.

Find Command column result

Found String 'find' is Highlighted.


Step 1: Find between labels/Lines.

set label for Find Command

Placing Label 'A' and 'B' in line 000005 and 000012

Find Command between label

Finding String 'XXX' between Lines of Label '.A' and '.B'

Step 2: Find between labels

Find Command between label result

Show result as 'CHARS 'XXX' found'.

If the word is not found. then it show the result as 'No CHARS 'XXX' found'.

Also, F 'string' .a .b 30 45 command will places the cursor at the first occurrence of the word 'string' between the labels .a and .b, between the columns 30 and 45.


FIND - Picture Clause

Picture clause searches are used to find occurrences of strings that have some common characteristics or that match some pattern. The strings are enclosed in single quotes and preceded by 'p'. All characters that do not stand for a picture can be used as they are.

For example, FIND P'VERSION#' ALL will find all occurrences of all the strings VERSION0, VERSION1, VERSION2...VERSION9. Each picture character stands for one character only.

A list of valid Picture characters is given as follows:

  • @ Alphabetic

  • # Numeric

  • < Lowercase

  • > Uppercase

  • $ Special Characters

  • . Non-displayable

  • = Any character including blanks

  • - Non-numeric

  • ~ Non-blank


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal