CONCAT (Concatenate) Keyword--Logical Files Only

Use this field-level keyword when you want to combine two or more fields from the physical file record format into one field in the logical file record format you are defining. The name of this concatenated field must appear in positions 19 through 28.

The format of the keyword is:

CONCAT(field-1 field-2...)

Specify the physical file field names in the order in which you want them to be concatenated, and separate them by blanks.

If the same physical field is specified more than once in a record format in the logical file (that is, by using either RENAME or CONCAT), the sequence in which the fields are specified in the logical file is the sequence in which the data is moved to the physical file on an update or insert operation. Thus, the value in the last occurrence of the physical field is the value that is put in the physical record and is the value that is used for all keys built over that physical field. All previous values of the same field are ignored.

If you want to use a field defined using the CONCAT keyword or a field specified as a parameter value on the CONCAT keyword as a key field, see DDS Key Field Name.

You cannot include a field containing decimal positions other than zero in a concatenated field. You can include a field having decimal positions of zero in which case the field is treated as an integer field.

The OS/400 program assigns the length of the concatenated field as the sum of the lengths (digits and characters) of the fields included in the concatenation.

The OS/400 program assigns the field to be fixed length or variable length based on the fields that are concatenated. The general rules are:

The OS/400 program assigns the data type based on the data types of the fields that are being concatenated. The general rules are:

When concatenating numeric fields, the sign of the farthest right field in the concatenation is used as the sign of the concatenated field. The signs of the other fields are ignored; however, they are present in the concatenated field. Therefore, if a negative value appears in a field other than the last, you must take appropriate action to delete the embedded signs (such as converting the concatenated field to packed decimal).

The maximum length of a concatenated field varies, depending on the data type of the concatenated field and the length of the fields being concatenated. If the concatenated field is zoned decimal (S), its total length cannot exceed 31 bytes. If the field is character (A) or hexadecimal (H), its total length cannot exceed 32 766 bytes. If the concatenated field is a variable length field, its total length cannot exceed 32 740 (32 739 if the field also allows the null value).

You cannot include a floating-point, date, time, or timestamp field in a concatenated field.

In join logical files, the fields to be concatenated must be from the same physical file. The first field specified on the CONCAT keyword identifies which physical file is used. The first field must, therefore, be unique among the physical files the join logical file is based on, or you must also specify the JREF keyword following the CONCAT keyword to specify which physical file to use.