AIF instruction
Use the AIF instruction to branch according to the results of a condition test. You can thus alter the sequence in which source program statements or macro definition statements are processed by the assembler.
The AIF instruction also provides loop control for conditional assembly processing, which lets you control the sequence of statements to be generated.
- sequence_symbol
- Is a sequence symbol
- logical_expression
- Is a logical expression (see Logical (SETB) expressions) the assembler evaluates during conditional assembly time to determine if it is true or false. If the expression is true (logical value=1), the statement named by the sequence symbol in the operand field is the next statement processed by the assembler. If the expression is false (logical value=0), the next sequential statement is processed by the assembler.
.OUT
if &C
= YES
:
AIF ('&C' EQ 'YES').OUT
.ERROR ANOP
.
.
.
.OUT ANOP
The sequence symbol in the operand field is a conditional assembly label that represents a statement number during conditional assembly processing. It is the number of the statement that is branched to if the logical expression preceding the sequence symbol is true.
- In open code, if the corresponding AIF instruction appears in open code
- In the same macro definition in which the corresponding AIF instruction appears.
You cannot branch from open code into a macro definition or between macro definitions, regardless of nested calls to other macro definitions.
F
.
MACRO
&N MOVE &T,&F
AIF (T'&T NE T'&F).END Statement 1
AIF (T'&T NE 'F').END Statement 2
&N ST 2,SAVEAREA Statement 3
L 2,&F
ST 2,&T
L 2,SAVEAREA
.END MEND Statement 4
The logical expression in the operand field of Statement 1 has the value true if the type attributes of the two macro instruction operands are not equal. If the type attributes are equal, the expression has the logical value false.
Therefore, if the type attributes are not equal, Statement 4 (the
statement named by the sequence symbol .END
) is the next
statement processed by the assembler. If the type attributes are
equal, Statement 2 (the next sequential statement) is processed.
The logical expression in the operand field of Statement 2 has
the value true if the type attribute of the first macro instruction
operand is not the letter F
. If the type attribute is
the letter F
, the expression has the logical value false.
Therefore, if the type attribute is not the letter F
,
Statement 4 (the statement named by the sequence symbol .END
)
is the next statement processed by the assembler. If the type attribute
is the letter F
, Statement 3 (the next sequential statement)
is processed.