By default an externally-described data structure (DCL-DS ... EXT,
DCL-DS ... EXTNAME('FILE'), or a fixed-format D ... E DS) imports each field under its short 10-character system name. Adding the ALIAS keyword imports each field under its alternative (long) name where one is defined:
DCL-DS emp EXTNAME('EMPMAST') ALIAS QUALIFIED;
// emp.EMPLOYEE_NAME, emp.EMPLOYEE_ID, ... (long names)
The alternative name comes from either source of external description:
- DDS - the field's
ALIAS(long-name)keyword in the physical/logical file. A field with noALIASkeyword keeps its short name. - SQL tables - the SQL long
COLUMN_NAME(as opposed to the 10-characterSYSTEM_COLUMN_NAME). A column whose long name is 10 characters or fewer has an identical short and long name, so it is imported unchanged.
Only fields that actually have an alternative name are renamed; a field without one keeps its short system name even under ALIAS. Without the ALIAS keyword, every field keeps its short name and a reference to the long name is an undefined-field error.
ALIAS combines with PREFIX: the prefix is applied to the name in effect (the long name where ALIAS supplies one), and the PREFIX(...:n) character-replacement count removes characters only from short (non-aliased) names - an aliased long name simply has the prefix prepended. ALIAS is valid in both free-form DCL-DS and the fixed-format D-spec keyword area.