REF (Reference) keyword—physical files only

Use this file-level keyword to specify the name of the file from which field descriptions are retrieved.

The format of the keyword is:
REF([library-name/]database-file-name [record-format-name])

REF supplies the field attributes from a previously defined record format. Specify the file name once in the REF keyword instead of on several REFFLD keywords if each field description refers to the same file. To refer to more than one file, use the REFFLD keyword. You can specify the REF keyword only once.

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 library list (*LIBL) in effect at file creation time is used. Specify a record-format-name as a parameter value for this keyword if there is more than one record format. If you do not specify the record-format-name, each record format is searched sequentially. The first occurrence of the field name is used.

You can specify a distributed data management (DDM) file on this keyword.

When using a DDM file, the database-file-name and library-name are the DDM file and library names on the source system. The record-format-name is the record format name in the remote file on the target system.

Note: Interactive data definition utility (IDDU) files cannot be used as reference files.

Examples

The following example shows how to specify the REF keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      REF(FILE1)
00020A          R RECORD
00030A            FLD1      R
     A

FLD1 has the same attributes as the first (or only) FLD1 in FILE1.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      REF(LIB1/FILE1 RECORD2)
00020A          R RECORD
00030A            FLD1      R
     A

FLD1 has the same attributes as FLD1 in RECORD2 in FILE1 in LIB1.

Related reference
Reference for physical and logical files (position 29)
Related information
When to specify REF and REFFLD keywords for DDS files