ALIAS
When the ALIAS keyword is specified for an externally-described data structure, the RPG compiler will use the alias (alternate) names for the subfields, if present. If the ALIAS keyword is not specified for the data structure, or an external field does not have an alias name defined, the RPG compiler will use the standard external field name.
When alias names are being used and you want to rename a subfield, you specify the alias name as the parameter to the EXTFLD keyword. The EXTFLD keyword does not support continuation, so you must specify the entire name on one source specification. Figure 1 shows an example with two data structures, defined for the same file. The data structure that has the ALIAS keyword coded uses the alias name, CUSTOMER_ADDRESS, as the parameter for the EXTFLD keyword. The data structure that does not have the ALIAS keyword coded uses the standard name, CUSTAD, as the parameter for the EXTFLD keyword.
- If keyword PREFIX(NEW_) is specified, there is no second parameter, so no characters will be replaced for any names. The names used for the RPG subfields will be NEW_CUSTOMER_NAME and NEW_XYID_NUM.
- If keyword PREFIX(NEW_:2) is specified, two characters will be removed from the names of fields that do not have an alias name. The names used for the RPG subfields will be NEW_CUSTOMER_NAME and NEW_ID_NUM. The first two characters, "XY", are replaced in XYID_NUM, but no characters are replaced in CUSTOMER_NAME.
- If keyword PREFIX('':2) is specified, two characters will be removed the names of fields that do not have an alias name. The names used for the RPG subfields will be CUSTOMER_NAME and ID_NUM. The first two characters, "XY", are replaced in XYID_NUM, but no characters are replaced in CUSTOMER_NAME.