Length for display files (positions 30 through 34)

You must specify a length for each named field unless you are copying the length from a referenced field.

The length is the number of bytes of data to pass to or receive from your program when I/O operations are done for the field. This is called the program length of the field.

The length of a field when it appears on the display is called the display length. The display length is greater than or equal to the program length. The display length of a field is determined by the keyboard shift (specified in position 35) and other field specifications, such as decimal positions (positions 36 and 37), and editing functions.

The display length does not include beginning and ending attribute characters of a field. However, you must consider these attribute characters when planning the display layout for field locations. Within a record, the ending attribute character of a field can overlap the beginning attribute character of the next field, requiring only one space between fields.

The maximum length of a character field is equal to the display size minus one. (This allows space for the beginning attribute character.) The maximum length of a numeric (zoned decimal) field is 63 positions. The maximum length of a single-precision floating-point field is 9 digits. The maximum length of a double-precision floating-point field is 17 digits.

You must not specify a field length for a constant field. See DATE (Date) keyword for display files, DFT (Default) keyword for display files, MSGCON (Message Constant) keyword for display files, or TIME (Time) keyword for display files for information about the lengths of constant fields.

If you specify length, it must be right-aligned. Leading zeros are optional. Figure 1 shows incorrect and correct field length specifications.

Figure 1. Incorrect and correct length specifications
|...+....1....+....2....+....3....+....4....+....5
00010A            FIELD1       7
     A
00020A            FIELD2         7
     A
00030A            FIELD3    R   +7
     A
Note: FIELD1 shows the field length specified incorrectly. FIELD2 and FIELD3 show the field length specified correctly.

If you use a referenced field, you can override the length of the field by specifying a new value or by specifying the increase or decrease in length. To increase the length, specify +n, where n is the increase. To decrease the length, specify -n, where n is the decrease. For example, an entry of +4 for a numeric field indicates a field that is 4 digits longer than the referenced field.

In some cases, some keywords specified with the field in the database file are not included in the display file if you specify a value for length.

A field cannot occupy the first position on the display. The first position is reserved for an attribute character. For example, on a 24 by 80 display, an entry of 1 in positions 39 through 41 (line), and 1 in positions 42 through 44 (position) is not allowed for a signed numeric field since the field starts in position 1.