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.
* 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)
1 FTESTPF IF E K DISK
2 FANY_NAME IF A E K DISK extfile('QTEMP/WRK_FILE')
3 F extdesc('TESTPF')
4 F extmbr('ONE')
5 F rename(TESTPFR:WORK_RCD)
The EXTDESC, on line 3, tells the compiler that it can use the file description of TESTPF when compiling. At compile time QTEMP/WRK_FILE does not have to exist.