bdfs1m0jStructured Programming Macros

Forms of Conditional Expressions

The TPFDF SPMs allow a number of different types of conditional expressions:

You can also use Boolean connectors to connect individual tests to form complex conditional expressions, as follows:

Conditional Expression Format







booleanop
is one of the following Boolean connectors:

n
is the condition code mask, in the range 0-15. For example:
    #IF   (7)
Note:
If you specify a conditional code mask of 0, a warning MNOTE is issued when the application is assembled.

mnemonic
is one of the condition-code mnemonics shown in Table 2.

Table 2. Mnemonics Allowed in SPM Expressions

Instruction Type Condition Mnemonic
Meaning Complement Condition Mnemonic Meaning
Compare H high NH not high
GT greater than LE less or equal
L low NL not low
LT less than GE greater or equal
EQ equal NE not equal
Arithmetic P
POSITIVE
positive NP
NOTPOSITIVE
not positive
M
NEGATIVE
minus (negative) NM
NOTNEGATIVE
not minus (not negative)
Z zero NZ not zero
O overflow NO not overflow
Test under Mask O, ON ones NO not ones
M
MIXED
mixed NM
NOTMIXED
not mixed
Z
ZERO, OFF
zeros NZ
NONZERO
not zeros

#EXEC
generates an EX instruction. See ESA/370 Principles of Operation or ESA/390 Principles of Operation for more information about the EX instruction.
Note:
You can also use the #EXEC macro alone; see #EXEC-Execute Macro for more information.

reg
is the register to use as the first operand in the EX instruction.

copcode
is an operation code starting with C; for example, CLC, CR, and so on.

opcode
is an operation code that sets a condition code but does not start with C; for example, TM, OC, and so on.

operand
is an operand for the instruction, which can be anything that the assembler language allows for an assembler instruction operand. See ESA/370 Principles of Operation or ESA/390 Principles of Operation for more information about assembler instructions and valid operands. Some of the types of operands include:

msk
is the M3 or R3 operand of an RS instruction. See ESA/370 Principles of Operation or ESA/390 Principles of Operation for more information about the RS instruction.

FILNC
processes the TPF or ALCS FILNC macro. See TPF General Macros or ALCS Application Programming Reference -- Assembler Language for more information about the FILNC macro.
Note:
The FILNC structure generates a WAITC internally to perform the test. Consider the effect of this test on performance when you use this form.

FINWC
processes the TPF or ALCS FINWC macro. See TPF General Macros or ALCS Application Programming Reference -- Assembler Language for more information about the FINWC macro.

FIWHC
processes the TPF or ALCS FIWHC macro. See TPF General Macros or ALCS Application Programming Reference -- Assembler Language for more information about the FIWHC macro.

WAITC
processes the TPF or ALCS WAITC macro. See TPF General Macros or ALCS Application Programming Reference -- Assembler Language for more information about the WAITC macro.

Dnum
specifies a data level, where num is a data level in the range 0-F.

num
specifies a data level, where num is a data level in the range 0-F.

OK
evaluates the conditional expression as true if the specified TPF or ALCS macro ends successfully.

NOK
evaluates the conditional expression as true if the specified TPF or ALCS macro does not end successfully.

LEVTA
processes the TPF or ALCS LEVTA macro. See TPF General Macros or ALCS Application Programming Reference -- Assembler Language for more information about the LEVTA macro.

INUSE
evaluates the conditional expression as true if the specified data level is being used.

NOTUSED
evaluates the conditional expression as true if the specified data level is available.

CPU
checks the symbolic processor ID of the ECB (field CE1CPD in the ECB).

operator
is one of the following operators:
Operator
Description
 EQ 
Equal
 NE 
Not equal
 LT 
Less than
 LE 
Less than or equal
 GT 
Greater than
 GE 
Greater than or equal.

cpuid
is the symbolic processor ID that you are checking.

DBFOUND
checks for the presence of a logical record (LREC), where:

YES
checks that the requested LREC exists.

NO
checks that the requested LREC does not exist.

See TPFDF Programming Concepts and Reference for more information about finding LRECs.

DBERROR
checks for serious errors, where:

YES
checks if a serious error occurred.

NO
checks if a serious error did not occur.

A serious error is an error that does not occur for obvious reasons and often results in a system error dump, such as an I/O error or corrupted data block.

Using this form is the same as specifying the ERROR parameter on a TPFDF assembler macro and can be used to process errors inline rather than at the end of the application program. See TPFDF Programming Concepts and Reference for more information about detecting errors and the SW00RTN settings for serious errors.

DBEOF
checks for an end-of-file (EOF), where:

YES
checks if an EOF condition was detected.

NO
checks if an EOF condition was not detected.

Use this form with the FULLFILE parameter on a TPFDF macro. See TPFDF Programming Concepts and Reference for more information about the TPFDF macros.

DBIDX
checks that an indexed detail file actually exists, where:

YES
checks if an indexed detail file exists.

NO
checks if an indexed detail file does not exist.

See TPFDF Programming Concepts and Reference for more information about creating indexed detail files. See TPFDF Database Administration for more information about indexed detail files in general.

DBEMPTY
checks for an empty subfile, where:

YES
checks if the subfile is empty.

NO
checks if the subfile is not empty.
Note:
This parameter is valid only after a delete operation that does not use fullfile processing and before the next TPFDF call.

Examples of Conditional Expressions

The following sections contain examples of the different forms of conditional expressions.

Branch on Condition Code Conditional Expression

In the following example, the branch on condition code form is used for the #ELIF macro.

         #IF   (LTR,R0,R0,P)
           :
*   Code to process if R0 is positive
           :
         #ELIF (Z)
           :
*   Code to process if register R0 is zero
           :
         #ELSE
           :
*   Code to process if register R0 is negative
           :
         #EIF
 

Compare Conditional Expressions

The following are examples of compare conditional expressions.

Noncompare Conditional Expressions

The following are examples of noncompare conditional expressions.

TPF and ALCS Macros as Conditional Expressions

The following are examples of using the TPF and ALCS macros as conditional expressions.

Checking the CPU ID Example

The following is an example of using the CPU operand to check for the processor ID.

         #IF   (CPU,EQ,C'A')
           :
*   Code to process
           :
         #EIF
 

Testing SW00RTN Bits Examples

The following are examples of testing the SW00RTN bits.

Testing SW00RT2 Bits Example

The following example checks if a subfile is empty.

         DBOPN REF=GR00SR,...
         DBRED REF=GR00SR,...
         #IF DBEMPTY,YES
           :
*   Code to process if a subfile is not empty
           :
         #EIF