Domain: PROCEDURE
Command description
The REPEAT-STMT command allows you to repeat the execution of a statement (SDF format). During the repetition of the statement, special parts of the statement (name part, operands, operand values) are substituted one after the other by the elements of an input list. These elements can be specified as records in a file, a library element or as list elements of an S variable, or they can be entered directly at the terminal. The statement specified will be called for each element in the input list.
The substitution can be done in principle at any location in the statement. It can also be defined at more than one location. The statement is only repeated, however, in a simple loop (no nested loops).
You can specify whether the elements from the input list are to be output again in a selection menu so that you can check them.
The statement is especially suited for executing statement that do not support the specification of more than one value (list-possible option).
Format
REPEAT-STMT |
STMT = <text 0..1800 with-low> ,SUBSTITUTION-LIST = *TERMINAL / <filename 1..54 without-gen-vers> / *VARIABLE(...) / *LIBRARY-ELEMENT(...) *VARIABLE(...) VARIABLE-NAME = <composed-name 1..255> *LIBRARY-ELEMENT(...) LIBRARY = <filename 1..54 without-vers> ,ELEMENT = <composed-name 1..64>(...) <composed-name 1..64>(...) VERSION = *HIGHEST-EXISTING / <composed-name 1..24> ,TYPE = S / <alphanum-name 1..8> ,DIALOG-SELECTION = *NO / *YES ,CONTINUE-AFTER-ERROR = *YES / *NO |
Operands
STMT= <text 0..1800 with-low>
Specification of the statement in SDF format whose execution is to be repeated. The specification is to be enclosed in parentheses. The %* characters are to be entered as placeholders for the substitution. The name of the statement is to be specified without the leading slash.
Example: STMT=(WRITE-TEXT TEXT='%*')
SUBSTITUTION-LIST = *TERMINAL / <filename 1..54 without-gen-vers> / VARIABLE(...) / *LIBRARY-ELEMENT(...)
Designates the input medium for the elements of the input list.
SUBSTITUTION-LIST = *TERMINAL
The elements of the input list are read from the terminal. After sending the REPEAT-STMT command, the “%>>:” string is output as a prompt. Every input for an element is to be confirmed with the keys. The prompt will then reappear. The reading of input is terminated when the *END-OF-CMD string is entered.
SUBSTITUTION-LIST = <filename 1..54 without-gen-vers>
The elements of the input list are read from the specified file (ISAM file with standard codes or SAM file). The reading of input is terminated when the end of the file is detected or the *END-OF-CMD string is read.
SUBSTITUTION-LIST = VARIABLE(...)
The elements of the input list of the specified variable list are read. The reading of input is terminated when the end of the list is detected or the *END-OF-CMD string is read.
VARIABLE-NAME = <composed-name 1..255>
Name of the list variable.
The variable must exist and have been declared as data of type STRING. (It can also be declared with the ANY data type, but then it may only contain string values).
SUBSTITUTION-LIST = *LIBRARY-ELEMENT(...)
The elements of the input list from the specified library element are read. The reading of input is terminated when the end of the file is detected or the *END-OF-CMD string is read.
LIBRARY = <filename 1..54 without-vers>
Name of the library.
ELEMENT = <composed-name 1..64>(...)
Name of the library element.
VERSION = *HIGHEST-EXISTING / <composed-name 1..24>
Version of the library element.
TYPE = S / <alphanum-name 1..8>
Type of library element.
DIALOG-SELECTION = *NO / *YES
Determines if a selection menu will be output on the terminal. All elements of the input list are listed in this menu for verification purposes. Any character can be used to mark the entries.
CONTINUE-AFTER-ERROR = *YES / *NO
Determines if execution will continue with the next element from the input list or if execution will be cancelled after a command has executed with errors.
Command return code
(SC2) | SC1 | Maincode | Meaning/Guaranteed messages |
0 | CMD0001 | No error | |
2 | 0 | SDP2000 | Warning: Not all elements in the input list could be successfully processed. Guaranteed message: SDP2000 |
1 | SDP2001 | None of the elements in the input list could be successfully processed. Guaranteed message: SDP2001 |
If processing was aborted after the first error due to the CONTINUE-AFTER-ERROR=*NO specification (message SDP2003
), then the return code of the faulty statement is returned.