## 8.3.4 Character Editing - the A Field Descriptor

The A field descriptor transfers character or Hollerith values. It takes the following form:

    A[w]

If the corresponding I/O list element has a character data type, character data is transmitted. If it has any other data type, Hollerith data is transmitted.

Input Processing

In an input statement, the A field descriptor transfers w characters from the external record and assigns them to the corresponding I/O list element. The maximum number of characters that can be stored depends on the size of the I/O list element. For character I/O list elements, the size is the length of either the character variable, the character substring reference, or the character array element.

For numeric I/O list elements, the size depends on the data type, as listed in Table 8-3.

### Table 8-3 Size Limit of Numeric Elements Using the A Field Descriptor

I/O List Element | Maximum Number of Characters
--- | ---
BYTE | 1
LOGICAL*1 | 1
LOGICAL*2 | 2
LOGICAL (LOGICAL*4) | 4
LOGICAL*8[1] | 8
INTEGER*1 | 1
INTEGER*2 | 2
INTEGER (INTEGER*4) | 4
INTEGER*8[1] | 8
REAL (REAL*4) | 4
DOUBLE PRECISION (REAL*8) | 8
REAL*16[2] | 16
COMPLEX (COMPLEX*8) | 8[3]
DOUBLE COMPLEX (COMPLEX*16) | 16[3]
[1] Alpha only [2] VMS, U*X [3] Because complex values are treated as pairs of real numbers, complex data editing requires two format descriptors. (See Section 8.3.2.5.)

If w is greater than the maximum number of characters that can be stored in the corresponding I/O list element, only the rightmost characters are assigned to that element. The leftmost excess characters are ignored.

If w is less than the number of characters that can be stored, w characters are assigned to the list element, left-justified, and trailing spaces are added to fill the element.

The following list illustrates valid input processing using the A field descriptor (the symbol ^ represents a nonprinting space character):

    Format    External Field     Internal Representation  Data Type

    A6        PAGE^#             #                        CHARACTER(LEN=1)

    A6        PAGE^#             E^#                      CHARACTER(LEN=3)

    A6        PAGE^#             PAGE^#                   CHARACTER(LEN=6)

    A6        PAGE^#             PAGE^#^^                 CHARACTER(LEN=8)

    A6        PAGE^#             #                        LOGICAL(1)

    A6        PAGE^#             ^#                       INTEGER(2)

    A6        PAGE^#             GE^#                     REAL(4)

    A6        PAGE^#             PAGE^#^^                 REAL(8)

Output Processing

In an output statement, the A field descriptor transfers the contents of the corresponding I/O list element to an external field w characters long. If w is greater than the list element size, the data appears in the field, right-justified, with leading spaces. If w is less than the list element, only the leftmost w characters are transferred.

The following list illustrates valid output processing using the A field descriptor (the symbol ^ represents a nonprinting space character):

    Format     Internal Value       External Representation

    A5         OHMS                 ^OHMS

    A5         VOLTS                VOLTS

    A5         AMPERES              AMPER

If w is omitted, a default value is supplied.

If the I/O list element has a character data type, the default value is the length of the I/O list element. If the I/O list element has a numeric data type, the default value is the maximum number of characters that can be stored in a variable of that data type.

Previous Page Next Page Table of Contents