EXEC Control Statements-&HEX, &IF
1. Yocr should use the &HEX control statement when you want to display
a hexadecimal value. For example: &HE'( ON &'IYPE X'40 &HE,( results in the display: 29 If vou did not use the &HEX ON control statementi the STIPE statement would result in the display: '('40 2. To convert a hexadecimal value to its decimal equivalent, use an
assignment statement.
3 The Guide should be consulted for examples of correct usage of EXEC control statements
in effect.
details and
with SHEX ON &IF Use the &IF control statement to test a condition in an EXEC procedure
and to perform a particular action if the test is valid. If the test is
invalid, execution continues with the statement following the &IP control statement. The format of the &IP statement is: r &IF '---- tokenl
token2 {
l}" &$ operator executable-statement
may be numeric constants, character
symbols. All variable symbols are
statement is executed.
strings, or EXEC variable
substituted before the SIF &$ tests all of the arguments entered when the EXEC was invoked.
If at least one of the arguments satisfies the specified
condition, the &IF statement is true. &* tests all of the arguments entered when the EXEC was invoked.
All of the entered arguments must meet the specified condition
in order for the &IF statement to be true.
operator indicates the test to be performed on the tokens. If both
tokens are numeric, an arithmetic test is performed.
otherwise, a logical (alphabetic) test is performed. The
comparison operators, listed below, may be specified either in
symbolic or mnemonic form: 2YID£Q! = or EQ
..,= or NE
< or LT
<= or LE
> or GT
>= or GE equals
not equal
less than
less than or equal to (not greater than)
greater than
greater than or equal to (not less than)
Section 5. EXEC Control statements 289
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
Previous Page Next Page