Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

BN Editing

The BN edit descriptor causes the processor to ignore all embedded and trailing blanks in numeric input fields. It takes the following form:

BN

The input field is treated as if all blanks have been removed and the remainder of the field is right-justified. An all-blank field is treated as zero.

Examples

If an input field formatted as a six-digit integer (I6) contains '2 3 4', it is interpreted as ' 234'.

Consider the following code:

       READ (*, 100) n
 100   FORMAT (BN, I6)

If you enter any one of the following three records and terminate by pressing Enter, the READ statement interprets that record as the value 123:

    123
 123
 123   456

Because the repeatable edit descriptor associated with the I/O list item n is I6, only the first six characters of each record are read (three blanks followed by 123 for the first record, and 123 followed by three blanks for the last two records). Because blanks are ignored, all three records are interpreted as 123.

The following example shows the effect of BN editing with an input record that has fewer characters than the number of characters specified by the edit descriptors and iolist. Suppose you enter 123 and press Enter in response to the following READ statement:

 READ (*, '(I6)') n 

The I/O system is looking for six characters to interpret as an integer number. You have entered only three, so the first thing the I/O system does is to pad the record 123 on the right with three blanks. With BN editing in effect, the nonblank characters (123) are right-aligned, so the record is equal to 123.