Use these positions to specify the length of a physical or logical file field.
For a physical file, use these positions to specify the field length for each named field (unless you copy it from a referenced field). Specify the number of digits for a numeric type field, or specify the number of characters for a character type field.
For a logical file, use these positions to specify the length of a logical field. Specify the length only to override or change the length of the corresponding field in the physical file on which this logical file is based. If you leave this position blank, the field you are defining has the same length as the corresponding field in the physical file(s) on which the logical file(s) is based. If the field in the physical file is variable length and you leave the length blank, the field is also variable length in the logical file. If you do specify a length, the field in the logical file is fixed length unless you also specify the VARLEN keyword. Additionally, the SST (Substring) keyword can be used to control the length of a logical file field by specifying a character string that is a subset of another field.
If you specify length, it must be right-aligned; leading zeros are optional.
Figure 1 shows correct and incorrect field length specifications for a physical file.
|...+....1....+....2....+....3....+....4....+....5 00010A FIELD1 7 A 00020A FIELD2 7 A 00030A FIELD3 R +7 A
Valid length specifications are:
Data type | Valid lengths |
---|---|
Character | 1 through 32 766 characters |
Hexadecimal | 1 through 32 766 bytes |
Binary | 1 through 18 digits |
Binary character | 1 through 32 766 characters |
Zoned decimal | 1 through 63 digits |
Packed decimal | 1 through 63 digits |
Floating-point (single precision) | 1 through 9 digits |
Floating-point (double precision) | 1 through 17 digits |
Date | 6, 8, or 10 characters |
Time | 8 characters |
Timestamp | 26 characters |
The length for fields with data type L (date), T (time), or Z (timestamp) is determined by the system. You should not enter a field length in positions 30 through 34.
The field length for date and time includes the separator.
YYYY-MM-DD-hh.mm.ss.uuuuuu
Type in a maximum of 9 digits for single precision and 17 digits for double precision. The i5/OS™ program supports a floating-point accuracy of 7 digits for single precision and 15 digits for double precision.
The total number of bytes occupied by all the fields in a record must not exceed 32 766 (in storage). See Table 1 for rules on determining the total length of the record format.
The system determines the number of bytes actually occupied in storage as follows:
Data type | Bytes occupied in storage |
---|---|
Character | Number of characters |
Hexadecimal | Number of bytes |
Binary | |
1 through 4 digits | 2 bytes |
5 through 9 digits | 4 bytes |
10 through 18 digits | 8 bytes |
Binary character | Number of characters |
Zoned decimal | Number of digits |
Packed decimal | (Number of digits/2) + 1 (truncated if fractional) |
Floating-point (single precision) | 4 bytes |
Floating-point (double precision) | 8 bytes |
Date | 10 characters without DATFMT keyword |
6, 8 or 10 characters with DATFMT keyword | |
Time | 8 characters |
Timestamp | 26 characters |
Table 1 describes the rules for determining total format length.
To override the length of a referenced field (R in position 29) of a physical file or the length of the field in a logical file, either specify a new value or a change in length. To increase the length, specify +n, where n is the amount of increase. To decrease the length, specify -n, where n is the amount of decrease. For example, type +4 to indicate that a numeric field is to be 4 digits longer than the referenced field. See the Positional entries for physical and logical files (positions 1 through 44) topic for an example showing how to override the field length for a physical file.
If the corresponding field in the physical file record format has a data type of binary with decimal positions greater than zero, the length cannot be overridden in the logical file. If the field you are describing is a concatenation of fields from the associated physical record format, you cannot specify the length in the logical file. The sum of the physical field lengths is calculated by the system.
For example, if the physical file field is defined as 4 characters long and the logical file field decreases the length to 2 characters, a value of ABCD in the physical file cannot be read by the program, although a value of AB can. In this case, the program can always write successfully. For character fields, the data is left-aligned and filled with blanks in the physical file field. For numeric fields, the data is right-aligned and filled with zeros in the physical file field.
Positions 30 through 34 are valid only for field specifications. You must leave these positions blank at the key field, select/omit field, join, record, and file level.