User Tools

Site Tools


ibm:vm370-lib:cmshelp:if.helpexc

IF

EXEC Interpreter

if.helpexc.txt
&IF STATEMENT                                                    EXEC statement

Use the &IF control statement to test a condition in an EXEC procedure and to
perform a particular action if the result is true.  If the test is invalid,
execution continues with the statement following the &IF control statement.
The format of the &IF statement is:
+-----------+-----------------------------------------------------------------+
| &IF       | token1|&$|&* operator token2|&$|&* executable-statement         |
+-----------+-----------------------------------------------------------------+
where:

token1 token2
         may be numeric constants, character strings, or EXEC variable
         symbols.  All variable symbols are substituted before the &IF
         statement is executed.

&$       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:
            Symbol      Operation
            = or EQ     equals
            ยฌ= or NE    not equal
            <  or LT    less than
            <= or LE    less than or equal to (not greater than)
            >  or GT    greater than
            >= or GE    greater than or equal to (not less than)

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 nested &IF statements
         must not exceed 32 tokens.


Usage Notes:

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 example:
       &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.
ibm/vm370-lib/cmshelp/if.helpexc.txt ยท Last modified: 2023/08/06 13:36 by Site Administrator