Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

REPEAT-CMD Repeat a command

&pagelevel(4)&pagelevel

Domain: PROCEDURE

Command description

The REPEAT-CMD command allows you to repeat the execution of a command. During the repetition of the command, special parts of the command (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 command specified will be called for each element in the input list.

The substitution can be done in principle at any location in the command. It can also be defined at more than one location. The command 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 command is especially suited for executing commands that do not support the specification of more than one value (list-possible option).

Format

REPEAT-CMD                                               

CMD = <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

CMD = <text 0..1800 with-low>
Specification of the BS2000 command 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 command is to be specified without the leading slash.Example: CMD=(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-CMD 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


0CMD0001No error
20SDP2000Warning: Not all elements in the input list could be successfully processed.
Guaranteed message: SDP2000

1SDP2001None 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 command is returned.

Example

The ENTER-PROCEDURE command is to be called several times for the same procedure, but with different job names. The values are to be entered at the terminal and then checked once:

/REPEAT-CMD (ENTER-PROC FROM=PROC.WAIT-600,JOB-CLASS=JCB00050,
             JOB-NAME=%*),SUBSTITUTION-LIST=*TERMINAL,DIALOG-SELECT=*YES
%>>: PROC01
%>>: PROC02
%>>: PROC03
%>>: TESTA
%>>: TESTB
%>>: PROC04
%>>: *END-OF-CMD

The inputting of the values was ended with *END-OF-CMD. The job names entered will be offered again for selection in a selection menu:

           Please select list elements
--------------------------------------------------------------------------------

 (x) PROC01
 (x) PROC02
 (x) PROC03
 ( ) TESTA
 ( ) TESTB
 (x) PROC04

--------------------------------------------------------------------------------

NEXT = *EXECUTE

       *ALL or *NONE or *EXECUTE or *CANCEL

The ENTER-PROCEDURE command starts the four jobs with the job names selected (marked in the menu with an x):

%  JMS0066 JOB 'PROC01' ACCEPTED ON 07-03-30 AT 11:17, TSN = 050L
%  JMS0066 JOB 'PROC02' ACCEPTED ON 07-03-30 AT 11:17, TSN = 050P
%  JMS0066 JOB 'PROC03' ACCEPTED ON 07-03-30 AT 11:17, TSN = 050Q
%  JMS0066 JOB 'PROC04' ACCEPTED ON 07-03-30 AT 11:17, TSN = 050R
/