+FIND

Syntax

── + ─┬─────┬─ FIND ─┬───────────────────┬─────────────────────────────┤
      └─ n ─┘        └─ DOWN ──<integer>─┘

Explanation

The +FIND command searches for target text defined by a previously-executed FIND command and displays the file in page mode. The +FIND command can be entered at the CANDE command level, which invokes page mode, or entered in page mode.

Under either of the following circumstances, you can enter the +FIND command in non-page mode to invoke page mode and display a page of a work file that includes target text:

  • You previously entered a FIND command with a specified target without specifying the PAGEMODE option.

  • You previously ran a FIND command with the PAGEMODE option specified and then entered a non-page mode command to exit page mode.

Typically, you use the +FIND command while in page mode. The command is automatically placed in the home position of page mode when a FIND command with the PAGEMODE option is specified.

+ <n> FIND

The + <n> FIND command construct enables you to search for the n th occurrence of the target from the current position of the page.

Successive searches for a target are always relative to the current position on the page, not from the beginning of the file.

The current position on a page is determined by the following circumstances:

  • If a FIND <target> :PAGEMODE command is entered, then the first occurrence of the target is displayed on the first line of text of the page. The first line with the target is the current position of the page. A subsequent +FIND command searches for the target immediately after that line.

  • If a PAGE <sequence range> command is entered, then the page is displayed with the specified beginning sequence number near the top of the page. That is the current position of the page. A subsequent +FIND command searches for the target immediately after that line.

  • If a +FIND DOWN <integer> command is entered, then the line of the target text is the current position of the page. A subsequent +FIND command searches for the target immediately after that line.

+ FIND DOWN <integer>

The DOWN <integer> option of the +FIND command enables you to specify the number of lines from the top of the page that you want the line of the target text displayed. The DOWN option can be any integer value between 0 and the size of the page for your terminal.

A target search begins from the line immediately following the current position of the page and displays the target line <integer> + 1 from the top of the page.

For example, if you enter the following command, the target line appears on the seventh line from the top of the page:

+FIND DOWN 6

The following are exceptions to this case:

  • If the DOWN option is greater than the location of the target line of the file, then the page with the target is displayed with no shift of text.

    For example, if you enter +FIND DOWN 10 and the next target is on the third line of the file, the page is displayed with no shift of text (the target remains on the third line).

  • If the DOWN option is greater than the size of the page of your terminal, then an error message is displayed and the DOWN option value retains the value previously set through the TERMINAL command.

  • If the DOWN option value is greater than the number of lines in the file, then the page is displayed with no shift of text.

Editing in Page Mode

You can edit the contents of a displayed page and continue to search for a target with the +FIND command. Updates to the work file are performed before each +FIND command is executed to save any changes to the displayed page. In this case, the target search begins from the line immediately following the line that was transmitted.

Defining the DOWN Option in CANDE Session and Command Levels

The DOWN <integer> option is used to shift a line on which a target appears in a file to a specified location on a page. This option can be defined at two levels:

  • CANDE command level

    The DOWN option for the CANDE command level is specified through the CANDE commands FIND, PAGE, and +FIND.

    The DOWN option value is effective for each use of the FIND, PAGE, or +FIND command that it is specified only. The DOWN option value specified at the CANDE command level is not retained for subsequent commands in which DOWN is not specified.

  • CANDE session level

    You can define the DOWN option for the CANDE session level with the TERMINAL command.

    The DOWN option specified during the CANDE command level takes precedence over the DOWN option specified for the CANDE session level. The DOWN option for the CANDE session level is used when DOWN is not specified with the CANDE commands FIND, PAGE, or +FIND.

Understanding +FIND Command Terminations

The +FIND command is terminated and CANDE displays an appropriate message for the following circumstances:

  • You issue a +FIND command, but a FIND command with a target was not previously run.

  • The +FIND command finds no more occurrences of a target.

Examples

The examples demonstrating the +FIND command features use the following work file named SAMPLE/PROGRAM:

GET SAMPLE/PROGRAM
#WORKFILE SAMPLE/PROGRAM: TEXT, 32 RECORDS, SAVED
LIST SAMPLE/PROGRAM
100 THIS IS A LIST
200 SAMPLE PROGRAM
300 COMMENTS
400 SOME VARIABLES
500 DEFINES HERE
600 SOME CODE HERE
 .
 .
 .
2300 CODE CONTINUES
2400 ANOTHER PAGE
2500 PAGE TWO
2600 SECOND LIST
2700 PROCEDURE ONE
2800 PROCEDURE TWO
2900 MORE COMMENTS
3000 MORE CODE HERE
3100 SOME MORE COMMENTS
3200 END OF PROGRAM

Example 1

The following displays show the results of a FIND command and a subsequent +FIND command transmitted in page mode:

FIND /COMMENTS/:PAGEMODE
+FIND    ....*....1....*....2....*....3....
00000300 COMMENTS
00000400 SOME VARIABLES
00000500 DEFINES HERE
00000600 SOME CODE HERE
 .
 .
 .
00002300 CODE CONTINUES 

The +FIND command that is automatically placed on the upper-left corner in page mode is transmitted and displays the next occurrence of “COMMENTS.”

+FIND    ....*....1....*....2....*....3....
00002900 MORE COMMENTS
00003000 MORE CODE HERE
00003100 SOME MORE COMMENTS
00003200 END OF PROGRAM
#DISPLAY COMPLETE

Example 2

This example demonstrates the way the +FIND command searches for a target after a file has been edited. The following display is a result of the FIND command:

FIND /HERE/:P
+FIND    ....*....1....*....2....*....3....
00000500 DEFINES HERE
00000600 SOME CODE HERE
 .
 .
 .
00002300 CODE CONTINUES
00002400 ANOTHER PAGE
00002500 PAGE TWO

Two new lines (2450 and 2475) are added to the file and the page is transmitted from the end of line 2475.

+FIND    ....*....1....*....2....*....3....
00000500 DEFINES HERE
00000600 SOME CODE HERE
 .
 .
 .
00002300 CODE CONTINUES
00002400 ANOTHER PAGE
00002450 HERE IS SOME MORE CODE
00002475 MORE COMMENTS
00002500 PAGE TWO

The following display is the result of the previous edit and the +FIND command transmitted from line 2475:

+FIND    ....*....1....*....2....*....3....
00003000 MORE CODE HERE
00003100 SOME MORE COMMENTS
00003200 END OF PROGRAM
#DISPLAY COMPLETE

The following display with the message “NO MORE OCCURRENCES” results when another +FIND command is transmitted from the end of line 3000. The cursor is positioned at the beginning of line 3200.

+FIND    ....*....1....*....2....*....3....
00003000 MORE CODE HERE
#NO MORE OCCURRENCES
00003200 END OF PROGRAM
#DISPLAY COMPLETE

Example 3

The following series of displays shows the results of the DOWN option set at both the CANDE command level and CANDE session level.

The following command is entered: FIND /LIST/,/ONE/ 2500-END:P

+FIND    ....*....1....*....2....*....3....
00002600 SECOND LIST
00002700 PROCEDURE ONE
00002800 PROCEDURE TWO
00002900 MORE COMMENTS
00003000 MORE CODE HERE
00003100 SOME MORE COMMENTS
00003200 END OF PROGRAM
#DISPLAY COMPLETE

After setting the DOWN option to 3 for the CANDE session with the TERMINAL command, the same FIND command is repeated (FIND /LIST/,/ONE/ 2500-END:P).

+FIND    ....*....1....*....2....*....3....
00002450 HERE IS SOME CODE
00002475 MORE COMMENTS
00002500 PAGE TWO
00002600 SECOND LIST
00002700 PROCEDURE ONE
00002800 PROCEDURE TWO
00002900 MORE COMMENTS
00003000 MORE CODE HERE
00003100 SOME MORE COMMENTS
00003200 END OF PROGRAM
#DISPLAY COMPLETE

The DOWN option at the CANDE command level is entered with the following command:

+FIND DOWN 2
+FIND    ....*....1....*....2....*....3....
00002500 PAGE TWO
00002600 SECOND LIST
00002700 PROCEDURE ONE
00002800 PROCEDURE TWO
00002900 MORE COMMENTS
00003000 MORE CODE HERE
00003100 SOME MORE COMMENTS
00003200 END OF PROGRAM
#DISPLAY COMPLETE

Example 4

The following display shows the results of searching the work file for the second occurrence of a target text string.

FIND /PROCEDURE/
# WORKFILE  SAMPLE/PROGRAM
  2700, 2800
#
+ 2 FIND
+FIND    ....*....1....*....2....*....3....
00002800 PROCEDURE TWO
00002900 MORE COMMENTS
00003000 MORE CODE HERE
00003100 SOME MORE COMMENTS
00003200 END OF PROGRAM
#DISPLAY COMPLETE