Example: A field reference file

This example defines all of the fields used in an application and refers to fields only within the field reference file itself.

The following keywords are important in the example:

COLHDG
EDTCDE(Z)
REFFLD
REFSHIFT
TEXT

The following field reference file (MLGREFP) describes all fields used by any program in the application. The other files use the fields in this file.

Figure 1. DDS for a field reference file
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A** FLDREF   MLGREFP    MAILING LIST FIELD REFERENCE FILE
00020A   (1)R MLGREFR                 TEXT('Mailing List Field Reference')
00030A            ACTNUM         5  0       COLHDG('Account' 'Number')
00040A                                      EDTCDE(Z)
00050A            ACTTYP         1  0       COLHDG('Acct' 'Type')
00060A                                      TEXT('Acct Type 1=Bus 2=Gvt +
00070A                                      3=Org 4=Sch 5=Pvt 9=Oth')
00080A            NAME          18          COLHDG('Name')
00090A                                      REFSHIFT(X)(4)
00100A            ADDR      R  (2)       (2)REFFLD(NAME)
00110A                                      COLHDG('Address')(3)
00120A            CITY      R  (2)       (2)REFFLD(NAME)
00130A                                      COLHDG('City')   (3)
00140A            STATE          2          COLHDG('State')
00150A            ZIP            5  0       COLHDG('ZIP' 'Code')
00160A                                      EDTCDE(X)
00170A            BATNUM         6  0       COLHDG('Batch' 'Number')
00180A                                      EDTCDE(Z)
00190A            TRNTYP         1          COLHDG('Trans' 'Type')
     A
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00200A                                      TEXT('Trans Type A=Add +
00210A                                      C=Change D=Delete')
00220A            XACTNM    R               REFFLD(ACTNUM)
00230A            XACTTTP   R               REFFLD(ACTTYP)
00240A            XNAME     R               REFFLD(NAME)
00250A            XADDR     R               REFFLD(ADDR)
00260A            XCITY     R               REFFLD(CITY)
00270A            XSTATE    R               REFFLD(STATE)
00280A            XZIP      R               REFFLD(ZIP)
00290A            TRNNUM         5  0       COLHDG('Transaction' 'Number')
00300A                                      EDTCDE(Z)
00310A            MLGLK1         3  0       COLHDG('Lock' 'Control')
00320A                                      TEXT('Control Number Used for +
00330A                                      record locking')
     A
Legend:
(1)
Like all physical files, a field reference file has only one record format. The R in position 17 specifies that MLGREFR is the record format name.
(2)
The Rs in position 29 and REFFLD in positions 45 through 80 specify that the fields ADDR and CITY are to have the same attributes as NAME.
(3)
Specifying COLHDG for ADDR and CITY overrides the COLHDG attribute for NAME, which otherwise will be in effect.
(4)
Specifying REFSHIFT for NAME will cause the keyboard shift specified (X) to be used when this field (NAME) is referred to in a display file.