Use this file-level keyword to specify the name of a file from which field descriptions are to be retrieved.
Use it when you want to duplicate descriptive information from several fields in a previously defined record format. This keyword allows you to code the file name once rather than on each field that refers to the file as is required by the REFFLD keyword. To refer to more than one file, use the REFFLD keyword. The REF keyword can be specified only once.
REF([library-name/]database-file-name [record-format-name])
If there is more than one record format in the reference file, specify a record format name as a parameter value for this keyword to tell the i5/OS™ operating system which one to use unless the record formats should be searched sequentially.
The database-file-name is a required parameter value for this keyword. The library-name and the record-format-name are optional.
If you do not specify the library-name, the current library list (*LIBL) at file creation time is used. If the record-format-name is not specified, each format is searched in order (as they are specified). The first occurrence of the field is used. For more information, see the topic When to specify REF and REFFLD keywords for DDS files.
You can specify a distributed data management (DDM) file on this keyword. When using a DDM file, the database-file-name and the library-name are the DDM file name and library name on the source system. The record-format-name is the record format name in the remote file on the target system.
Option indicators are not valid for this keyword.
In the first example, FLD1 has the same attributes as the first (or only) FLD1 in the file, FILE1:
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A REF(FILE1) A R RECORD A FLD1 R A
In the second example, FLD1 has the same attributes as FLD1 in RECORD2 in FILE1 in LIB1:
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8 A REF(LIB1/FILE1 RECORD2) A R RECORD A FLD1 R A