The bit (or B) format item describes the character representation of a bit value. Each bit is represented by the character zero or one.
|
On input, the character representation of the bit string can occur anywhere within the specified field. Blanks, which can appear before and after the bit string in the field, are ignored. Any necessary conversion occurs when the bit string is assigned to the data-list item. The field width is always required on input, and if it is zero, a null string is obtained. Any character other than 0 or 1 in the string, including embedded blanks, quotation marks, or the letter B, raises the CONVERSION condition.
On output, the character representation of the bit string is left-adjusted in the specified field, and necessary truncation or extension with blanks occurs on the right. Any necessary conversion to bit-string is performed. No quotation marks are inserted, nor is the identifying letter B. If the field width is zero, no characters are placed into the data stream. If the field width is not specified, the default is equal to the bit-string length of the data-list item (after conversion, if necessary, according to the rules given in Data conversion).
In the example:
declare Mask bit(25); put file(Maskfle) edit (Mask) (B);
The PUT statement writes the value of Mask in Maskfle as a string of 25 characters consisting of zeros and ones.