EXTNAME(file-name{:format-name}{:*ALL| *INPUT|*OUTPUT|*KEY|*NULL})

The EXTNAME keyword is used to specify the name of the file that contains the field descriptions used as the subfield description for the data structure being defined.

The file_name parameter is required. Optionally a format name may be specified to direct the compiler to a specific format within a file. If format_name parameter is not specified the first record format is used.

  • In a free-form definition, the file-name and format-name parameters must be character literals or named constants representing character literals. If a parameter is a named constant, the constant must be defined prior to the definition statement.
  • In a fixed-form definition, the file-name and format-name parameters can be either names or character literals.
If a character literal is specified, the file or format name must be specified in the correct case. For example, if the external file is MYFILE, the file-name parameter could be specified as a name in mixed case such as myFile or myfile, but if specified as a literal it must be 'MYFILE'. If the file-name is a character literal, it can be in any of the following forms
'LIBRARY/FILE'
'FILE'
'*LIBL/FILE' 

The remaining extract-type parameters specify which fields in the external record to extract.

  • *ALL extracts all fields.
  • *INPUT extracts just input capable fields.
  • *OUTPUT extracts just output capable fields.
  • *KEY extracts just key fields.

*NULL can also be specified to indicate that instead of defining the subfields with the same data types as the fields in the file, the subfields are all indicators. For a database file, these indicators have the same layout as the null byte map for the record.

If no extract-type is specified, or only *NULL is specified, the compiler extracts the fields of the input buffer.

Note:
  1. If the format-name is not specified, the record defaults to the first record in the file.
  2. For *INPUT and *OUTPUT when *NULL is not specified, subfields included in the data structure occupy the same start positions as in the external record description. When *NULL is specified, the indicators occupy the same start position as the null indicators in the null byte map for the external record for a database file. For other types of files, the start positions of the indicator subfields are assigned sequentially.

If an externally-described data structure (EXT keyword for a free-form definition, or E in position 22 for a free-form definition, and the EXTNAME keyword is not specified, the data structure name is used for the external name.

If *NULL is not specified, the compiler generates the following definition specification entries for all fields of the externally described data structure:
  • Subfield name (Name will be the same as the external name, unless the ALIAS keyword is specified for the data structure, or the field is renamed by the EXTFLD keyword, or the PREFIX keyword on a definition specification is used to apply a prefix).
  • Subfield length
  • Subfield internal data type (will be the same as the external type, unless the CVTOPT control specification keyword or command parameter is specified for the type. In that case the data type will be character).

If *NULL is specified, the subfield name will be generated in the same way. However, the length will be 1 and the data type will be indicator.

All data structure keywords except LIKEDS and LIKEREC are allowed with the EXTNAME keyword.

However, if *NULL is specified, CCSID(*EXACT) is not allowed.

Data structures that are defined with the extract-type *NULL cannot be used with I/O operations.

Data structures that are defined with no extract-type cannot be used with I/O operations.