bdfs1m0j | Structured Programming Macros |
The TPFDF SPMs allow a number of different types of conditional
expressions:
- A symbolic representation of a standard assembler language instruction
that results in a condition code setting or branch. This form consists
of the following types:
- Branch on condition code instructions
- Compare instructions
- Noncompare instructions.
See ESA/370 Principles of Operation or ESA/390 Principles of Operation for more information
about specific assembler instructions.
- A symbolic representation of certain TPF or ALCS macro calls.
- Special operands to check a CPU ID.
- Special operands to test the return conditions in the TPFDF SW00RTN
bits. This form is available only for application programs written for
a TPFDF environment.
See TPFDF Programming Concepts and Reference for
more information about testing return conditions and SW00RTN.
You can also use Boolean connectors to connect individual tests to form
complex conditional expressions, as follows:
- Connect individual tests with an AND or OR connector to form groups
- Connect groups of tests with an ANDIF or ORIF connector to form complex
expressions
- 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.
The following sections contain examples of the different forms of
conditional expressions.
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
The following are examples of compare conditional expressions.
- The following example shows how to compare two fields.
#IF (CLC,FLDA,NE,FLDB)
:
* Code to process
:
#EIF
- The following example shows how to compare two registers.
#IF (CR,R2,EQ,R3)
:
* Code to process
:
#EIF
- The following example shows how to compare a register to a literal.
#IF (C,R2,EQ,=F'25')
:
* Code to process
:
#EIF
The following are examples of noncompare conditional expressions.
- The following example shows how the result of an Insert Character under
Mask (ICM) instruction can be used in a conditional expression.
#IF (ICM,R2,7,FLD,NZ)
:
* Code to process
:
#EIF
- The following example shows how to test 4 bits of a field in a conditional
expression.
#IF (TM,FLD,X'F0',NO)
:
* Code to process
:
#EIF
The following are examples of using the TPF and ALCS macros as conditional
expressions.
- In the following example, the code is processed if the FINWC macro is
processed successfully.
#IF (FINWC,D3,OK)
:
* Code to process
:
#EIF
- In the following example, the code is processed if the WAITC macro is
not processed successfully.
#IF (WAITC,NOK)
:
* Code to process
:
#EIF
- In the following example, the code is processed if data level 2 (D2) is
not being used.
#IF (LEVTA,D2,NOTUSED)
:
* Code to process
:
#EIF
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
The following are examples of testing the SW00RTN bits.
- The following is an example of the DBFOUND operand.
DBOPN REF=GR00SR,...
DBRED REF=GR00SR,...
#IF DBFOUND,NO
:
* Code to process if an LREC is successfully read
:
#EIF
- The following is an example of the DBERROR operand.
DBOPN REF=GR00SR,...
DBRED REF=GR00SR,...
#IF DBERROR,YES
:
* Code to process if a serious error is found
:
#EIF
- The following is an example of the DBEOF operand.
DBOPN REF=GR01SR,...
#DO INF
DBRED REF=GR01SR,FULLFILE,...
#DOEX DBEOF,YES
:
* Code to process if EOF condition is not detected
:
#EDO
- The following is an example of the DBIDX operand.
DBOPN REF=GR01SR,...
DBRED REF=GR01SR,...
#IF DBIDX,NO
:
* Code to process if the requested detail file does not exist
:
#EIF
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