IF

Generated from C.60.01 /SYS/PUB/CICAT last modified on Thu Jan 11 09:18:52 2001

Back to Main Index


IF

     Used to control the execution sequence of a job, UDC or
     command file.  (CM)

SYNTAX


     IF expression [THEN]


PARAMETERS


expression          Logical expression, consisting of operands and
                    relational operators. The following operators may be
                    incorporated in expression

                    The DO keyword is optional.  It may be used or
                    omitted and has no effect.  The allowed operands
                    are any variable, integer, string, or Boolean
                    constants, and the MPE/iX reserved words are WARN,
                    FATAL, SYSTEM, and OK.

                    Compound logical expressions can be formed using
                    the And, Not, Xor, and Or logical operators, and
                    nested within parentheses.


OPERATION


     IF command up to, but not including, the next ELSE or
     ENDIF statement.  The ELSE or ENDIF must have the same
     nesting level as the IF statement.  Another similar block
     can follow the ELSE statement.  Nesting of the blocks is
     allowed to 30 levels.  The ENDIF statement ends the IF
     block.

     The logical expression is evaluated and, if the expression
     evaluates to true, the IF block is executed; if false, the
     ELSE block (if one exists) is executed.

     You may not write an IF construct in such a way that it
     physically crosses from one User Command (UDCs or command
     files) to another.

     o  To see a list of expression evaluator functions, type
        FUNCTIONS at the HELP prompt.  Or, you may enter an
        individual function name for more specific information.

     o  To see a list of FINFO options, type FINFO at the HELP prompt.

     o  To see a list of predefined MPE/iX variables, type VARIABLES
        at the HELP prompt.  Or, you may enter an individual variable
        name for more specific information.

     This command may be issued from a session, job, in BREAK, or
     programmatically.  Pressing [Break] terminates the INPUT()
     function.


EXAMPLE(S)


     The following job listing illustrates the use of an IF
     statement with ELSE and ENDIF statements

     !CONTINUE
     !PASXL MYPROG,MYUSL
     !IF JCW>=FATAL THEN
     !   TELL MAC.TECHPUBS;COMPILE FAILED
     !ELSE
     !   TELL MAC.TECHPUBS;COMPILE COMPLETED
     !ENDIF

ADDITIONAL INFORMATION


Commands:   CALC, DELETEVAR, ELSEIF, ENDIF, SETJCW, SETVAR,
            SHOWJCW, SHOWVAR, WHILE; see also FUNCTIONS and
            VARIABLES

Manuals :   Appendix B, "Expression Evaluator Functions," of
            the MPE/iX Commands Reference Manual (32650-90003)

Back to Main Index