REF (Reference) keyword in printer files

You use this file-level keyword to specify the name of a file from which field descriptions are to be retrieved.

The format of the keyword is:

REF([library-name/]data-base-file-name [record-format-name])

Use REF when you want to duplicate descriptive information from one or more fields in a previously defined record format. You can code the file name once on the REF keyword rather than on the REFFLD keyword with each of the field descriptions that reference the file.

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 IBM® i operating system which record format to use, unless the formats should be searched sequentially.

The database-file-name is required for this keyword. The record-format-name and the library-name are optional.

If you do not specify the library-name, the current library list at file creation time is used. If you do not specify the record-format-name, each format is searched in order (as they are specified). The first occurrence of the field name is used.

You can specify a distributed data management (DDM) file on this keyword. When you use a DDM file, the data-base-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.

Example 1

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

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

Example 2

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

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