The B data edit descriptor transfers binary (base 2) values. It takes the following form:
The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width). The m has no effect on input, only output.
The specified I/O list item can be of type integer, real, or logical.
On input, the B data edit descriptor transfers w characters from an external field and assigns their binary value to the corresponding I/O list item. The external field must contain only binary digits (0 or 1) or blanks.
If the value exceeds the range of the corresponding input list item, an error occurs.
The following shows input using the B edit descriptor:
Format Input Value
B4 1001 9
B1 1 1
B2 0 0
On output, the B data edit descriptor transfers the binary value of the corresponding I/O list item, right-justified, to an external field that is w characters long.
The field consists of zero or more blanks, followed by an unsigned integer constant (consisting of binary digits) with no leading zeros. A negative value is transferred in internal form.
If m is specified, the unsigned integer constant must have at least m digits. If necessary, it is padded with leading zeros.
If m is zero, and the output list item has the value zero, the external field is filled with blanks.
The following shows output using the B edit descriptor (the symbol ^ represents a nonprinting blank character):
Format Value Output
B4 9 1001
B2 0 ^0
For More Information: