%IF
ANSI
The Percent Conditional Compilation Directives allow the testing of conditions to determine if a section of PL/B code is included or excluded from the compilation process. They use the following formats:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where:
value1
Required. A previously EQUATEd label, binary, decimal, octal, or hexadecimal value evaluated.
op
Optional. One of the following comparison operators: <, >, <=, >=, =, <>.
value2
Optional. A previously EQUATEd label, binary, decimal, octal, or hexadecimal value evaluated.
valuen
Optional. A previously EQUATEd label, binary, decimal, octal, or hexadecimal value evaluated.
directive
Optional. One of the compiler directives from the table below.
datalabel
Optional. A previously defined Data Definition Label.
Flags Affected: NONE
Note the following:
Each of the instructions beginning with a C is an alternate form for the corresponding instruction beginning with a %.
Each conditional compilation construct that begins with a %IF, %IFDEF, %IFNDEF, %IFZ, or %IFNZ instruction must be terminated with a %ENDIF instruction.
Unlike the IF directives, the %ENDIF instruction only terminates the most current %IF directive.
The %ELSEIF and %ELSE instruction are only allowed while a %IF construct is active. Any number of %ELSEIF instructions may be used and one %ELSE instruction may be used. If the %ELSE instruction is used, it must be after all %ELSEIF instructions for the given construct.
At least one space is required between {value1} and {op}, and between {op} and {value2}.
%IF directives may be nested up to one hundred (100) levels deep.
For a given construct, at most only one group of instructions is compiled by the compiler. In the case where there are multiple %ELSEIF instructions that would evaluate to a true condition, only the first one to evaluate to a true condition is compiled.
The %IFDEF and %IFNDEF instructions test whether a {datalabel} has been declared. If the {datalabel} operand of these directives is not terminated by a blank character, a compiler warning is given by default when the program is compiled. If the compiler option '-B' is specified, the compiler gives an error rather than a warning.
The %IFZ and %IFNZ instructions allow for testing the value of one or more equated variables. In the case of the %IFZ instruction, if any variable is zero, the instruction is true. In the case of the %IFNZ instruction, if any variable is not zero, the instruction is true.
Valid {directives} are as follows:
|
Directive |
Retrieves ... |
|
DTYPE |
a sixteen-bit value representing the type of the data variable. The type values can be found in the PLBEQU.INC include file. |
|
DTYPEBASE |
an eight-bit value representing the base type value of {dataLabel} variables. These equated values can be found in the PLBEQU.INC include file. |
|
DTYPESUB |
an eight-bit value representing the subtype value of {dataLabel} variables. Only some variables have subtypes. These equated values can be found in the PLBEQU.INC include file. |
|
ATYPE |
a value that identifies whether a {dataLabel} variable is an array variable. If a value of zero is retrieved, the variable is not an array. Otherwise, the value represents the total number of elements in the array. |
|
PTYPE |
a value that indicates whether the variable is a pointer. A value of zero indicates that a variable is not a pointer. |
|
DEFINED |
The results of a DEFINED compiler directive. |
|
MDEFINED |
The results of a MDEFINED compiler directive. |
|
MDEFAULT |
The results of a MDEFAULT compiler directive. |
|
MPARAMNUM |
The results of a MPARANUM compiler directive. |
See Also: Example Code, IF, Compiler Directives
![]() |