SCAN
The SCAN statement provides a means for extending the functionality of the scan option during input processes. (See the User Manual for a full discussion of the scan option.)
••••• SCAN
••• •••••••••••••••••••••• ••• = ••• ••••••••••••••••••••••
•••
(1)
(2) (3) (4) (5) (6) (7)
(7) Source occurrence (constant/index) | |
(4) Destination occ (constant/index) |
|
The SCAN statement becomes effective only when the user has selected the scan option, or when the predefined field OPTION is set to SCAN with statements.
The scan option permits the user to select a record in a referenced file, and then automatically moves the key for that file into the corresponding fields of the input record. The SCAN statement provides a more general capability for moving fields from a user-selected record into corresponding fields of another record.
The source field of the SCAN statement must be a field in an indexed file. Multiple SCAN statements may be executed. When the user selects the scan option, the names of the files containing the source fields of the SCAN statement(s), as well as the name of the file containing the data lookup field on which the cursor is positioned (if data lookup is defined), are displayed to the user for selection. If there is only one such file, that file is selected automatically.
If the user scans and selects a record from the selected file, the values in the source field of each SCAN statement (for source fields in the selected file only) are moved into the destination field of the SCAN statement. If any of these destination fields are defined as input items, the new values for these fields are displayed on the image.
The SCAN statement can be used to handle situations in which a field is both a key to the referenced file and part of a key to another referenced file. It can also be used to automatically set fields other than the key field when the user selects a record in the referenced file. Lastly, the SCAN statement can be used to access the process control file.
The SCAN statement can be used only in image-related event points in input processes.
In the following example, if the scan option is selected when the cursor is positioned at the substitute product ID field, the SCAN statement is executed to enable the user to scan the PRODUCT file.
IF ---
OPTION EQ SCAN
T AT FIELD TIC SUBSTITUTE
PRODUCT ID (AT APPEARANCE # )
TT SCAN TIC
SUBSTITUTE PRODUCT ID = TIC
PRODUCT ID