RPG/400 Help

TESTB (Test Bit)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| TESTB   |               | Bit numbers     | Character      |   OF ON EQ    |
|         |               |                 | field          |               |
*---------*---------------*-----------------*----------------*---------------*

The TESTB operation compares the bits identified in factor 2 with the corresponding bits in the field named as the result field. The result field must be a one-position character field. Resulting indicators in positions 54 through 59 reflect the status of the result field bits. Factor 2 is always a source of bits for the result field.

Factor 2 can contain:

Figure "TESTB Operation" illustrates uses of the TESTB operation.

Indicators assigned in positions 54 through 59 reflect the status of the result field bits. At least one indicator must be assigned, and as many as three can be assigned for one operation. For TESTB operations, the resulting indicators are set on as follows:

TESTB Examples

Figure 58. TESTB Operation

*...1....+....2....+....3....+....4....+....5....+....6....+....7...
CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++
C*
C*  The field bit settings are FLDF = 00000001, and FLDG = 11110001.
C*
C*  Indicator 16 is set on because bit 3 is off (0) in FLDF.
C*  Indicator 17 is set off.
C                     TESTB'3'       FLDF       16  17
C*
C*  Indicator 16 is set on because both bits 3 and 6 are off (0) in
C*  FLDF.  Indicators 17 and 18 are set off.
C                     TESTB'36'      FLDF       161718
C*
C*  Indicator 17 is set on because bit 3 is off (0) and bit 7 is on
C*  (1) in FLDF.  Indicators 16 and 18 are set off.
C                     TESTB'37'      FLDF       161718
C*
C*  Indicator 17 is set on because bit 7 is on (1) in FLDF.
C*  Indicator 16 is set off.
C                     TESTB'7'       FLDF       16  17
C*
C*  Indicator 17 is set on because bits 0,1,2, and 3 are off (0) and
C*  bit 7 is on (1).  Indicators 16 and 18 are set off.
C                     TESTBFLDG      FLDF       161718
C*
C*  The hexadecimal literal X'88' (10001000) is used in factor 2.
C*  Indicator 17 is set on because bit 0 is on and bit 4 is off.
C*  Indicators 16 and 18 are set off.
C                     TESTBX'88'     FLDG       161718


[ Top of Page | Previous Page | Next Page | Table of Contents ]