CONCAT (Concatenate) keyword

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

The name of this concatenated field must appear in positions 19 through 28. Specify the physical file field names in the order in which you want them to be concatenated, and separate them by blanks.

The following rules and restrictions apply:
  • The operating system assigns the length of the concatenated field as the sum of the lengths (digits and characters) of the fields that are included in the concatenation.
    Note: For fields with data type J, the shift-out and shift-in pairs between the concatenated fields are removed from the resulting field. If the resulting data type is hexadecimal, the shift-out and shift-in pairs are eliminated for DBCS fields that precede the first hexadecimal fields.
  • A DBCS-graphic field can be concatenated only with another graphic data type field.
  • The operating system assigns the data type based on the data types of the fields that are being concatenated. When bracketed-DBCS fields are included in a concatenation, the general rules are:
    • If the concatenation contains one or more hexadecimal (H) fields, the resulting data type is hexadecimal (H).
    • If all fields in the concatenation are DBCS-only (J), the resulting data type is DBCS-only (J).
    • If the concatenation contains one or more DBCS (O, E, J) fields, but no hexadecimal fields, the resulting data type is DBCS-open (O).
  • The operating system assigns the field to be fixed length or variable length based on the fields that are being concatenated. The general rules are:
    • Concatenation of a variable length field to either a fixed length field or another variable length field results in a variable length field.
    • Concatenation of a fixed length field to a fixed length field results in a fixed length field unless the VARLEN keyword is also specified on the same field as the CONCAT keyword.
  • 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 63 bytes; if it is character (A) or DBCS(O, J), its total length cannot exceed 32 766 bytes. If the concatenated field is variable length, its total length cannot exceed 32 740 bytes (32 739 if the field also allows the null value).

    If the concatenated field is a DBCS-graphic (G) field, its total length cannot exceed 16 383 characters. If the concatenated field is variable length, its total length cannot exceed 16 370 characters.

  • 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 on which the logical file is based, or you must also specify the JREF keyword to specify which physical file to use.
  • When one or more of the fields being concatenated are DBCS fields, none of the fields on the CONCAT keyword can be specified as a key, select, or omit field unless the field name is also specified in positions 19 through 28 or on a RENAME or CONCAT keyword specified before the DBCS concatenation.
  • The usage of a concatenated field must be I (input only).
  • REFSHIFT cannot be specified on a concatenated field that has been assigned a data type of O or J.

Example

The following example shows how to specify the CONCAT keyword on the DDS coding form.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A          R RECORD 1                  PFILE(PF1)
     A            FLD1               I      CONCAT(PFLD1 PFLD2)
     A            FLD2               I      CONCAT(PFLD1 PFLD2 PFLD3)
     A            FLD3               I      CONCAT(PFLD4 PFLD5)
     A
In the example, if the fields from PF1 are:
  • PFLD1 with data type J
  • PFLD2 with data type J
  • PFLD3 with data type E
  • PFLD4 and PFLD5 with data type G
Then the resulting fields are:
  • FLD1 with data type J
  • FLD2 with data type O
  • FLD3 with data type G
Related reference
CONCAT (Concatenate) keyword—logical files only