TM


1 TM(string,mask)

Tests selected bits of a string and sets the condition code accordingly.

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. If a mask bit is zero, the equivalent string bit is ignored. If the tested bits are all ones, TM returns 1. Otherwise, TM returns 0.

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)
  exit
 end
exit 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(fld(3,1),'10000000'b) then do
  outrec = OVERLAY(BITOR(fld(2,1),'04'x),outrec,2)
  exit
end
exit drop