Previous Topic Next topic Print topic


Output Conversion

For B-Format output conversion, an arithmetic or string value given by the PUT statement's format list is converted to a bit string using the normal rules for conversion to bit strings. The resulting bit string is then padded on the left with sufficient zero bits to make it a multiple of k bits in length, where kis the 1, 2, 3, or 4 following the B in the format code. The padded bit string is then converted to a character string of length n, where n is the length of the padded string divided by k. (All k bits are converted to one character, as shown in the table in Bit-String Data.) If w is omitted, w is the length of the character string. The character string is right-justified in a field of w blanks. w must be sufficient to hold all of the characters in the string.

The following results are produced by the various forms of the B-Format.

Value Format     Field
'00'B B 00
'1'B B(4) boxes1
"B B(4) boxes
'1101'B B2(2) 31
'110101'B B3(2) 65
'10011101'B     B4(2) 9D
'10111'B B2(4) boxes113
Previous Topic Next topic Print topic