bdfs1m0kStructured Programming Macros

Condensed Forms of Conditional Expressions

Programming conventions in the TPF and ALCS environments allow the following assumptions when operands in an expression are evaluated:

These assumptions allow you to use condensed forms of certain conditional expressions.

Condensed Forms of Compare

You can omit the operation code when the context of a test is not ambiguous.

Table 3 shows examples of condensed conditional expressions and the Cxx instruction that is generated for each one.

Table 3. Instructions Generated for Condensed Forms of Compare

Conditional Expression Generates Remarks
#IF R14,EQ,R15 CR  
#IF R14,GE,EBW000 C No slash (/) defaults to a 4-byte comparison.
#IF R14,LT,10(R15) C  
#IF R14,LE,=H'123' CH  
#IF R14,GT,H/24(R15) CH The H/ forces a CH.
#IF EBW000,NE,FLD CLC  
#IF EBW000,LT,5 CLI  
#IF EBW000,GT,C'D' CLI  
#IF EBW000,NL,#CAR CLI  
#IF EBW000,L,I/FLAG CLI The I/ forces a CLI.

Condensed Forms of TM

For a TM instruction, you can omit the operation code (TM) if the second operand begins with the characters BIT. The second operand provides a symbolic name for the bits to be tested, as shown in the examples in Table 4.

Table 4. Instructions Generated for Condensed Forms of TM

Conditional Expression TM Mask Remarks
#IF EBW000,BIT3,OFF X'10' Operand BITn tests bit n.
#IF EBW000,BITS4-6,MIXED X'0E' Operand BITSn-m tests bits n through m.
#IF EBW000,BITS1/3/5/7,ON X'55' Operand BITSp/q/r/s tests bits p, q, r, and s.

Condensed Forms of LTR and OC

You can omit the operation code and the second operand if the first and second operands of an LTR or OC instruction are the same.

Table 5. Instructions Generated for Condensed Forms of LTR and OC

Conditional Expression Generates
#IF R14,NONZERO LTR R14,R14
#IF FLD(4),ZERO OC FLD(4),FLD

Condensed Forms of Boolean Expressions

If the operand or condition code mnemonic (or both) are repeated in a test, you can omit the second operand or condition code mnemonic (or both).