HLASM Toolkit Feature User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


The IF macro set

HLASM Toolkit Feature User's Guide
GC26-8710-10

The IF macro set implements the IF THEN ELSE program figure. The flowchart for this figure is:
                      ┌──────┐
                      │      │
              ┌───→───┤  F1  ├────→────┐
              │true   │      │         │
              │       └──────┘         │
           ┌──┴──┐                  ┌──┴──┐
           │     │                  │     │
   ────→───┤IF(P)│                  │ENDIF├─────→
           │     │                  │     │
           └──┬──┘                  └──┬──┘
              │       ┌──────┐         │
              │false  │      │         │
              └───→───┤  F2  ├────→────┘
                      │      │
                      └──────┘

In this figure, the test of the predicate p is represented by the IF macro, which determines whether process F1 or F2 is to be executed. The exit path from the macro is represented by the terminator ENDIF macro. The general IF macro set is written:

In the IF examples that follow, the parentheses surrounding the predicate are optional.
        IF  p  THEN
          Code for F1
        ELSE
          Code for F2
        ENDIF
If the ELSE is not used, the flowchart is reduced to one that does not contain function F2 and is written:
        IF p THEN
          Code for F1
        ENDIF

The format of the predicate p may take one of the forms discussed in Table 1. In each form the keywords AND, OR, ANDIF, and ORIF are optional. THEN is a comment and must be preceded by one or more spaces if used.

All these forms of the predicate p may be used in the DOEXIT, EXITIF, and WHEN macros.

Table 1. Predicate values and connector/terminator values
Predicate Values Connector/Terminator
numeric condition code mask (1 to 14) condition mnemonic instruction, parm1, parm2, condition compare-instruction, parm1, condition, parm2 AND OR ANDIF ORIF
Note: Do not use the connectors AND, OR, ANDIF, and ORIF as program labels.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014