Purpose
A multibit binary constant is a 1- to 32-character string that can contain only the values 1 and 0. The string is enclosed in single quotation marks with the first quotation mark immediately preceded by the character B.
B'110101'
Usage
A multibit binary constant can be used as a comparison for a data field and can be used to store a value in a data field.
The data field must be an elementary data field defined with the USAGE IS BIT clause. If the data field is an occurring field within a group, all other data fields in the group must be defined with USAGE IS BIT.
In general, groups in record structures are of type EBCDIC. Multibit binary is an exception. Even at the group level, multibit binary (MBB) fields should be referenced for MOVEs or comparisons with B'...' fields. Specifically, a MBB group field would be initialized to all zeroes by moving B'000...' to the MBB field, or by redefining the MBB field with an EBCDIC field and moving LOW-VALUES to the redefined EBCDIC field.
Example 1: Data field definition
02 MASK-VALUE PIC X(7) USAGE IS BIT.
02 MASK-VALUE-OCCURRENCE REDEFINES MASK-VALUE
PIC X USAGE IS BIT OCCURS 7 TIMES.
Example 2: Process command
MOVE B'1001000' TO MASK-VALUE
WHILE MASK-VALUE EQ B'1001000'
REPEAT.
.
.
.
IF DB-END-OF-SET
THEN
MOVE B'0' TO MASK-VALUE-OCCURRENCE (4).
END.
|
Copyright © 2014 CA.
All rights reserved.
|
|