This example shows how to describe a logical file using DDS.
The DDS for a logical file, shown in the next example, must be
in the following order:
- 1
- File-level entries (optional). In this example, the UNIQUE
keyword indicates that for this file the key value for each record must be
unique; no duplicate key values are allowed.
For each record format:
- 2
- Record format level entries. In this example, the record format name,
the associated physical file, and an optional text description are specified.
- 3
- Field-level entries (optional). In this example, each field name used
in the record format is specified.
- 4
- Key field level entries (optional). In this example, the Order field
is used as a key field.
- 5
- Select/omit field level entries (optional). In this example, all records
whose Opnsts field contains a value of N are omitted from the file's
access path. That is, programs reading records from this file will never see
a record whose OPNSTS field contains an N value.
- 6
- Comment.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A* ORDER HEADER FILE (ORDHDRP)
A 6
A 1 UNIQUE
A 2 R ORDHDR PFILE(ORDHDRP)
A 3 ORDER TEXT('Order number')
A CUST TEXT('Customer number')
A .
A .
A .
A 4 K ORDER
A O OPNSTS 5 CMP(EQ 'N')
A S ALL
A
logical file must be created after all physical files on which it is based
are created. The PFILE keyword in the previous example is used to specify
the physical file or files on which the logical file is based.
Record formats in a logical file can be:
- A new record format based on fields from a physical file
- The same record format as in a previously described physical or logical
file.
Fields in the logical file record format must either appear in
the record format of at least one of the physical files or be derived from
the fields of the physical files on which the logical file is based.