The EXTDESC keyword can be specified to indicate which file the compiler should use at compile time to obtain the external descriptions for the file.

The file specified by the EXTDESC keyword is used only at compile time. At runtime, the file is found using the same rules as would be applied if the EXTDESC keyword was not specified. You can use additional keyword EXTFILE(*EXTDESC) if you also want the file specified by the EXTDESC keyword to be used at runtime.

The EXTDESC keyword must be specified before any keywords that have record format names as parameters such as IGNORE, INCLUDE, RENAME, and SFILE, and before any keywords whose validity depends on the actual file, such as INDDS and SLN.

The parameter for EXTDESC must be a named constant or literal specifying a valid file name. If it is a named constant, it must be defined before the file definition. You can specify the value in any of the following forms:
  1. You cannot specify *CURLIB as the library name.
  2. If you specify a file name without a library name, *LIBL is used.
  3. The name must be in the correct case. For example, if you specify EXTDESC('qtemp/myfile'), the file will not be found. Instead, you should specify EXTDESC('QTEMP/MYFILE').
  4. If you have specified an override for the file that RPG will use for the external descriptions, that override will be in effect. If the EXTDESC('MYLIB/MYFILE') is specified, RPG will use the file MYLIB/MYFILE for the external descriptions. If the command OVRDBF MYFILE OTHERLIB/OTHERFILE has been used before compiling, the actual file used will be OTHERLIB/OTHERFILE. Note that any overrides for the name specified in positions 7-15 will be ignored, since that name is only used internally within the RPG source member.
Figure 1. Example of the EXTDESC keyword.
 * At compile time, file MYLIB/MYFILE1 will be used to
 * get the definition for file "FILE1", as specified by
 * the EXTDESC keyword.
 * At runtime, file *LIBL/FILE1 will be opened.  Since
 * the EXTFILE keyword is not specified, the file name
 * defaults to the RPG name for the file.
Ffile1     if   e             disk
F                             extdesc('MYLIB/MYFILE1')
 * At compile time, file MYLIB/MYFILE2 will be used to
 * get the definition for file "FILE2", as specified by
 * the EXTDESC keyword.
 * At runtime, file MYLIB/MYFILE2 will be opened, as
 * specified by the EXTFILE(*EXTDESC) keyword.
Ffile2     if   e             disk
F                             extdesc('MYLIB/MYFILE2')
F                             extfile(*extdesc)