Definitions and Records
Data Definition Language (DDL) Reference Manual — 426798-002
5- 26
Key Assignment Syntax
The CUST record derives its record structure from the definition of CUSTINFO:
Notice that the key fields are qualified by the record name.
The record SUPPLIER-INFO requires the alternate key to be unique:
RECORD supplier-info .
FILE IS "$data.sales.supplier" KEY-SEQUENCED .
02 suppnum PIC 9(4) .
02 suppname PIC X(18) .
02 addr TYPE * .
KEY IS suppnum .
KEY "sn" IS suppname DUPLICATES NOT ALLOWED .
END
In the following record definition, two alternate key fields have the same name and
must be qualified.
RECORD phones .
FILE IS "\dallas.$data.sales.person"
KEY-SEQUENCED .
02 social-security PIC 9(9) .
02 home-phone TYPE phone .
02 work-phone TYPE phone .
KEY IS social-security .
KEY "hc" IS home-phone.area-code .
KEY "wc" IS work-phone.area-code .
END
The next example shows FUP output for creating an alternate key file specified in a
RECORD statement.
DDL Source Code:
RECORD test-1.
FILE IS "Test1".
02 f-1 TYPE BINARY.
02 f-2 PIC X(10).
02 f-3 TYPE COMPLEX.
RECORD cust .
FILE IS "$data.sales.customer" .
KEY-SEQUENCED .
DEF IS custinfo .
KEY IS cust.custnum .
KEY "nm" IS cust.custname .
END .
File name
File type
Record structure
Primary Key
Alternate Key
VST502.vsd