SCAN

SCAN

This command is used to search for a string of characters within an object, with the option to replace the string with another string.

The object may be a single object, all objects beginning with a specified setting, or all objects within a library. The scan may also be restricted to a specific object type.

Important:
The source work area is used by the SCAN command. Therefore, a SAVE or STOW command should be issued before using the SCAN command.

Note:
This command is not executable in batch mode.

This document covers the following topics:


SCAN Menu Options

Any objects except maps, DDMs and data areas can be modified using the scan utility. You can also use the full screen editor to modify other lines than scanned lines. When the object is modified, save it and close the editor. You can then continue scan processing.

When you issue the SCAN command, a window is displayed where you can specify the following:

Field Explanation
Scan value The value to be searched for.
Replace value The value which is to replace the scan value.
Delete value Will cause the scan value to be deleted (Y/N).
Object name The object(s) to be scanned:
blank All objects.
*
name* All objects whose names begin with name.
Object type The type(s) of object to be scanned:
P Programs
C Copycodes
N Subprograms
S Subroutines
H Helproutines
M Maps
G Global data areas
L Local data areas
A Parameter data areas
T Texts
4 Classes
* All types
Absolute scan Y Will result in an absolute scan.
N If absolute scan is set to "N", the scan value must be separated by a blank or specific character.
Library The ID of the library to be scanned. Default is the current library.
Case sensitive N The search will be for the scan value regardless whether it occurs in upper case, lower case, or a mixture of both.
Y The search will be for the scan value exactly as you specify it.

Make the desired specifications and press ENTER. A window appears displaying the lines containing the searched for scan value.

+-------------------- Search value MOVE in Program READVAR---------------------+
¦ Commands:                                                                    ¦
¦ 0440     MOVE EMPLOYEES-VIEW.NAME       TO #NAME (J)                         ¦
¦ 0450     MOVE EMPLOYEES-VIEW.FIRST-NAME TO #FIRST (J)                        ¦
¦ 0960            MOVE #NAME(6) TO #START-NAME                                 ¦
¦ 0980            MOVE 'D' TO #DIR           /* new direction DESCENDING       ¦
¦ 1020            MOVE #NAME(1) TO #START-NAME                                 ¦
¦ 1050          MOVE 'A' TO #DIR             /* new direction ASCENDING        ¦
¦ 1090          MOVE #NAME(6) TO #START-NAME                                   ¦
¦ 1180          MOVE #NAME(6) TO #START-NAME                                   ¦
+------------------------------------------------------------------------------+

SCAN Subcommands

Any desired subcommand can be entered in the above window. To enter the command mode, place the cursor in the Commands line and press ENTER.

Then you can select one of the following commands:

Command Function
Edit Edit object.

Note:
This command is not available if the Natural program, data area and map editor are disabled in your environment. For more information, see NaturalONE as the Default Development Environment in the Editors documentation.

List List object as it currently appears in the source work area.
Ignore Ignore the object currently being scanned, do not save any modifications, and continue with next object.
Quit Terminate scan processing.

A subcommand can also be invoked by entering its first character.

To deactivate command mode, press ESC.

SCAN Editing Rules

  • If the Replace option is used and/or an object is updated in the scan utility, the object will always be saved unless Ignore or Quit is specified before the next object is scanned.

  • Lines containing PASSWORD=, PASSW=, CIPHER=, or CIPH= will be ignored by the SCAN command.

  • The line length of the source object in the scan utility is limited to 72.

  • If the replace value causes a line to exceed 80 characters, the line will be split automatically.

SCAN under Natural Security

In order to use SCAN in a Natural Security environment, the system commands LIST, EDIT, and READ must be allowed in the current library's security profile. If the Replace option is to be used, the system command SAVE must also be allowed.

Under Natural Security, the use of the SCAN command may be disallowed in some libraries.