DDS Length (Positions 30 through 34)

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 may be used to control the length of a logical file field by specifying a character string that is a subset of another field. For more information about SST keyword, see "SST (Substring) Keyword--for Logical Files Only".

If you specify length, it must be right-justified; leading zeros are optional.

Figure 16 shows correct and incorrect field length specifications for a physical file.

Figure 16. Correct and Incorrect Length Specifications for Physical Files

|...+....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.

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.

A timestamp has a fixed format that has the following form:

YYYY-MM-DD-hh.mm.ss.uuuuuu

Type in a maximum of 9 digits for single precision and 17 digits for double precision. The OS/400 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).

Note:
The system performs arithmetic operations more efficiently for a packed decimal than for a zoned decimal data type.

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 Figure 3 for an example showing how to override the field length for a physical file. Figure 1 shows how to change and override the field length for a logical 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.

If you specify a value in positions 30 through 34, your program sees the specified length. However, the length of the field in the corresponding physical file field does not change. This can cause data conversion errors. When attempting to add a member to a file or to open a member of a file, the OS/400 program may send a mapping error message. The OS/400 program may also send a mapping error message to your program in the following cases:

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-justified and filled with blanks in the physical file field. For numeric fields, the data is right-justified 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.

Note:
High-level languages can impose restrictions on the field length. Any length restrictions should be observed for files used by these high-level languages.