REF (Reference) keyword for display files

Use this file-level keyword to specify the name of a file from which field descriptions are to be retrieved or when you want to duplicate descriptive information from several fields in a previously described record format.

You can code the file name once here rather than on REFFLD keywords with each of the field descriptions that refer to the file. To refer to more than one file, use the REFFLD keyword. (REF can be specified only once.)

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

If there is more than one record format in the referenced 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 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 record format is searched in order (as they are specified). The first occurrence of the field name is used. See the When to specify REF and REFFLD keywords for DDS files topic for the search sequences determined by your choice of REF and REFFLD keywords.

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: IDDU files cannot be used as reference files.

Option indicators are not valid for this keyword.

Examples

The following examples show how to specify the REF keyword.

In this example, FLD1 has the same attributes as the first (or only) FLD1 in FILE1.

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

In this example, FLD1 has the same attributes as FLD1 in RECORD2 in FILE1 in LIB1.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      REF(LIB/FILE1 RECORD2)
00020A          R RECORD
00030A            FLD1      R           2  2
     A
Related concepts
Reference for display files (position 29)