TM
Tests selected bits of a string and sets the condition code accordingly. See FLD_TM for a similar function that is FASTREXX eligible.
- Returns
- If the tested bits are all ones, then TM returns 1. Otherwise, TM returns 0.
- string
- A literal string, or variable representing a string.
- mask
- A bit-string determining which bits to test in string.
The length of the test is based on the length of the shorter of the two arguments, string and mask. A mask bit of one indicates that the equivalent bit in string is to be tested. When a mask bit is zero, the equivalent string bit is ignored.
Example 1
Test the third byte of the input record and, if the low order bit
is set, overlay a hex FF into the second byte of that record.
If TM(FLD(3,1),'01'x) Then Do
outrec = OVERLAY('FF'x,outrec,2)
Return
End
Return 'DROP'
Example 2
Test the third byte of the input record and, if the high order
bit is set, logically OR a hex 04 over the contents of the second
byte of that record.
If TM(FLC(3,1),'10000000'b) Then Do
outrec = OVERLAY(BITOR(fld(2,1),'04'x),outrec,2)
Return
End
Return 'DROP'