Control Statements-&IF, &LOOP executable-statement
is any valid EXEC executable statement which may be a CMS command, an EXEC control statement, or an assignment
statement. You may also specify another &IF statement; the
number of &IF statements that may be nested is limited only by
the record length of the file. In fixed-length EXEC files,
only the first 72 characters of the line are scanned.
1. The values &* and &$ are reset when an &ARGS or &READ ARGS control
statement is executed. They are not changed when you reset a
specific numeric variable (&1 through &30). 2. If a variable symbol used in an &IF control statement is undefined,
the EXEC interpreter cannot properly compare it. In cases where a
variable may be null, or to check for a null symbol, you should use
a concatenation character when you write the &IF statement; for
&IF .&1 EQ &GOTO -NOARGS tests for a null symbol &1.
3. If the symbols &* or &$ are null because no arguments were entered,
the entire &IF statement is treated as a null statement. &LOOP Use the SLOOP control statement to describe a loop in an EXEC procedure,
including the conditions for exit from the loop. The format of the &LOOP control statement is:
r------------ -------------------------------, : &LOOP , , L
is a positive integer from 0 to 4095 that indicates the
number of executable and nonexecutable lines in the loop.
These lines must immediately follow the &LOOP statement.
specifies that all of the lines following the &LOOP statement down to, and including the line with the specified
label, are to be executed in the loop. The first character
of the label must be a hyphen, and it must be the first
token on a line. The remainder of the line may contain an
executable statement, or it may be null.
is a positive integer from 0 to 4095 that indicates the
number of times the loop is to be executed.
specifies the condition that must be met. The syntax of the
exit condition is the same as that in the &IF statement,
that is: 290 IBM VM/37Q CMS Command and Macro Reference
EXEC Control Statements-&LOJP, &PUNCH, &READ
1. When loop execution is control passes to the next
statement following the end of the loop.
The condition is always tested before the loop is executed. LL the
specified condition is met, then the loop is not executed. For
example, the statement: &LOOP 3 &COUNT = 100 specifies that the next three lines are interpreted until the value
of &COUNT is 100.
3. LOops may be nested up to four levels deep. All nested loops may ena at the same label.
4. A loop is closed when the requirements for termination specified in tha &LOOP statement are met, or when control is transferred outside
the scope of the loop (using &GOTO or &SKIP). &PUNCH Use tha &PUNCH control statement to punch a line of tokens to the
virtual card punch. The format of the &PUNCH control statement is: r , &PUNCH L- rtok1 rtok2 ••• rtokn]]]
tok1 [tok2 ••• [tokn]]
specifies the tokens to be punched. All tokens are padded or trJncated to eight characters. The punched line is right-padded
with blanks to fill an 80-column card. If no tokens are specified,
a line consisting of 80 blank characters is punched. 1. Lines punched with the &PUNCH control statement are scanned by the EXEC interpreter and variable symbols are substituted before the
line is punched. In fixed-length EXEC files, only the first 72
characters of the record are scanned. To punch one or more lines
of unscanned data, use the &BEGPUNCH or &BEGPUN:H ALL control
2. When you have finished punching lines in an EXEC procedure, you can use the CP command CLOSE to close the spool punch file and release
it for processing.
&READ Use the &READ control statement to read one or more lines from the
terminal or console stack. The lines may contain data or executable
statements. The format of the &READ control statement is: Section 5. EXEC Control Statements 291
Previous Page Next Page