FLD_TM

Read syntax diagramSkip visual syntax diagram
Syntax

              .-1-----.                                  
>>-FLD_TM--(--+-------+--,--mask--,--+------------+--)---------><
              '-start-'              | .-1-.      |      
                                     '-+---+-type-'      

Note: Commas following the last specified argument can be omitted.

Can be used in FASTREXX condition expressions.

Tests selected bits of a field in the input record.

Returns
Returns 1 if the test evaluates as True, and 0 if the test evaluates as False.
start
Position, in bytes, in the input record at which to start testing. The length of the field is defined by the mask. Can be specified as:
Absolute position
Must be a positive integer. Default value is 1. If start is greater than the current length of the input record, the function has no effect.
Relative to current INPOS
Can be specified as IPx or INx, or as Px or Nx. If this resolves to a value of less than or equal to zero, the function results in an error. If this resolves to a value that is greater than the current length of the input record, the function has no effect.
Relative to current OUTPOS
Must be specified as OPx or ONx. If this resolves to a value of less than or equal to zero, the function results in an error. If this resolves to a value that is greater than the current length of the input record, the function has no effect.
mask
Bit-string determining which bits to test in the field. The length of the mask defines the length of the input field. This field defines a bit-string mapping used to test the specified bits in the input record. You can use the bit-string, hex-string or character-string formats to define this field, Therefore, '0100 0000'b, '40'x, and ' ' are all legitimate and equivalent ways of defining a mask to test the second bit of a one-byte field.
type
Type of test.
1
FLD_TM returns True (1) if all the bits that are on in the mask are on in the input record field. This is the default value.
0
FLD_TM returns True (1) if all the bits that are on in the mask are off in the input record field.
M
FLD_TM returns True (1) if at least one of the bits that are on in the mask is on in the input record, and at least one is off.
N
FLD_TM returns True (1) if at least one of the bits that are on in the mask is off in the input record field.

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 the output record.

 If FLD_TM(3,'01'x) Then Do
   OVLY_OUT('ff'x,2,1)
   Return
 End
 Return 'DROP'

Example 2

Test the third byte of the input record and if some of the three high order bits are set, and some are not, overlay the contents of the second byte of that record with a hex 04.

 If FLD_TM(3,'11100000'b,M) Then Do
   OVLY_OUT('04'x,2,1)

Example 3

Test the current INPOS position of the input record and, if the low order bit is set, overlay a hex FF into the byte prior to this location in the output record.

 If FLD_TM(P0,'01'x) Then Do
   OVLY_OUT('ff'x,IN1,1)
   Return
 End
 Return 'DROP'