REFFLD (Referenced Field) keyword—physical files only

Use this field-level keyword to refer to a field under one of these three conditions.

These conditions are:
  • When the name of the referenced field is different from the name in positions 19 through 28
  • When the name of the referenced field is the same as the name in positions 19 through 28, but the record format, file, or library of the referenced field is different from that specified with the REF keyword
  • When the referenced field occurs in the same DDS source file as the referencing field
The format of the keyword is:
REFFLD([record-format-name/]referenced-field-name
[{*SRC | [library-name/]database-file-name}])
The referenced-field-name is required even if it is the same as the name of the field being defined. Use the record-format-name when the referenced file contains more than one record format. Use *SRC (rather than the database-file-name) when the field name being referred to is in the same DDS source file as the field being defined. *SRC is the default value when the database-file-name and the library-name are not specified.
Note: When you refer to a field in the same DDS source file, the field being referred to must precede the field being defined.

Specify the database-file-name (with its library-name, if necessary) to search a particular database file.

An R must be in position 29. Some keywords specified with the field being referred to are not included on the field being defined. For more information, see the Reference for physical and logical files (position 29) topic.

If you specify REF at the file level and REFFLD at the field level in the same DDS source file, the REFFLD specification is used. The search sequence depends on both the 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 referenced-field-name and the record-format-name are the field name and 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.

Example

The following example shows how to code the REFFLD keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R FMAT1
00020A            ITEM           5
00030A            ITEM1     R               REFFLD(ITEM)
00040A            ITEM2     R               REFFLD(FMAT1/ITEM)
00050A            ITEM3     R               REFFLD(ITEM FILEX)
00060A            ITEM4     R               REFFLD(ITEM LIBY/FILEX)
00070A            ITEM5     R               REFFLD(FMAT1/ITEM LIBY/FILEX)
00080A            ITEM6     R               REFFLD(ITEM *SCR)
     A

The default for lines 00030 and 00040 is to search the DDS source file where they are specified because the REF keyword is not specified. In line 00080, the parameter *SRC explicitly specifies this source file.

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