The description of an externally described file contains the access path that describes how records are to be retrieved from the file. Records can be retrieved based on an arrival sequence (non-keyed) access path or on a keyed-sequence access path.
The arrival sequence access path is based on the order in which the records are stored in the file. Records are added to the file one after another.
For the keyed-sequence access path, the sequence of records in the file is based on the contents of the key field that is defined in the DDS for the file. For example, in the DDS shown in Figure 166, CUST is defined as the key field. The keyed-sequence access path is updated whenever records are added, deleted, or when the contents of a key field change.
For a complete description of the access paths for an externally described database file, refer to the DB2 Universal Database for iSeries section of the Database and File Systems category in the i5/OS Information Center at this Web site - http://www.ibm.com/systems/i/infocenter/.
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ..*
A..........T.Name++++++.Len++TDpB......Functions++++++++++++++++++++*
A** LOGICAL CUSMSTL CUSTOMER MASTER FILE
A UNIQUE
A R CUSREC PFILE(CUSMSTP)
A TEXT('Customer Master Record')
A CUST
A NAME
A ADDR
A CITY
A STATE
A ZIP
A SRHCOD
A CUSTYP
A ARBAL
A ORDBAL
A LSTAMT
A LSTDAT
A CRDLMT
A SLSYR
A SLSLYR
A K CUST
The sample DDS are for the customer master logical file CUSMSTL. The file contains one record format CUSREC (customer master record). The data for this file is contained in the physical file CUSMSTP, which is identified by the keyword PFILE. The UNIQUE keyword is used to indicate that duplicate key values are not allowed for this file. The CUST field is identified by a K in position 17 of the last line as the key field for this record format.
The fields in this record format are listed in the order they are to appear in the record. The attributes for the fields are obtained from the physical file CUSMSTP. The physical file, in turn, refers to a field-reference file to obtain the attributes for the fields. The field-reference file is shown in Figure 167.
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ..*
A..........T.Name++++++RLen++TDpB......Functions++++++++++++++++++++*
A**FLDRED DSTREF DISTRIBUTION APPLICATION FIELD REFERENCE
A R DSTREF TEXT('Distribution Field Ref')
A* COMMON FIELDS USED AS REFERENCE
A BASDAT 6 0 EDTCDE(Y) 1
A TEXT('Base Date Field')
A* FIELDS USED BY CUSTOMER MASTER FILE
A CUST 5 CHECK(MF) 2
A COLHDG('Customer' 'Number')
A NAME 20 COLHDG('Customer Name')
A ADDR R REFFLD(NAME) 3
A COLHDG('Customer Address')
A CITY R REFFLD(NAME) 3
A COLHDG('Customer City')
A STATE 2 CHECK(MF) 2
A COLHDG('State')
A SRHCOD 6 CHECK(MF) 2
A COLHDG('Search' 'Code')
A TEXT('Customer Number Search +
A Code')
A ZIP 5 0 CHECK(MF) 2
A COLHDG('Zip' 'Code')
A CUSTYP 1 0 RANGE(1 5) 4
A COLHDG('Cust' 'Type')
A TEXT('Customer Type 1=Gov 2=Sch+
A 3=Bus 4=Pvt 5=Oth')
A ARBAL 8 2 COLHDG('Accts Rec' 'Balance') 5
A EDTCDE(J) 6
A ORDBAL R REFFLD(ARBAL)
A COLHDG('A/R Amt in' 'Order +
A File')
A LSTAMT R REFFLD(ARBAL)
A COLHDG('Last' 'Amount' 'Paid')
A TEXT('Last Amount Paid in A/R')
A LSTDAT R REFFLD(BASDAT)
A COLHDG('Last' 'Date' 'Paid')
A TEXT('Last Date Paid in A/R')
A CRDLMT R REFFLD(ARBAL)
A COLHDG('Credit' 'Limit')
A TEXT('Customer Credit Limit')
A SLSYR R+ 2 REFFLD(ARBAL)
A COLHDG('Sales' 'This' 'Year')
A TEXT('Customer Sales This Year')
A SLSLYR R+ 2 REFFLD(ARBAL)
A COLHDG('Sales' 'Last' 'Year')
A TEXT('Customer Sales Last Year') 7
This example of a field-reference file shows the definitions of the fields that are used by the CUSMSTL (customer master logical) file as shown in Figure 166. The field-reference file normally contains the definitions of fields that are used by other files. The following text describes some of the entries for this field-reference file.