The database administrator describes each data set. The description includes the name of the data set, the type of organization to be used, the logical and physical options for the storage of records, and a description of the record format. In addition, the database administrator can define integrity, security, and initialization controls for data.
The following diagram illustrates the syntax for defining data sets:
<data set declaration>
──<data set name>─┬─────────────┬─┬─ DATA ─────┬─┬───────────┬─────────► ├─ COMPACT ───┤ ├─ DATA SET ─┤ └─<comment>─┘ ├─ DIRECT ────┤ ├─ DATA-SET ─┤ ├─ ORDERED ───┤ └─ DATASET ──┘ ├─ RANDOM ────┤ ├─ RESTART ───┤ ├─ STANDARD ──┤ └─ UNORDERED ─┘ ►─┬──────────────────────────────────┬─────────────────────────────────► └─ REORGANIZE ─┬─ (ITEMS SAME) ────┤ └─ (ITEMS CHANGED) ─┘ ►─┬─────────────────────────────────────┬──────────────────────────────► │ ┌◄────────────────────────────────┐ │ └─┴─┬─<data set logical option>───┬─┴─┘ └─<data set physical options>─┘ ►─<record description>─┬─────────────────────────────┬─────────────────┤ └─<data set physical options>─┘
The following table explains the elements of the syntax diagram:
Option |
Description |
---|---|
The data set name is an identifier that names the data set. The data set name cannot exceed 17 characters. |
|
COMPACT, DIRECT, ORDERED, RANDOM, RESTART, STANDARD, and UNORDERED |
These options are the available data set organization types (Refer to Structure Formats.) When no organization is specified, a standard organization is assumed. |
The DASDL update compiler now accepts changes made to any structure. A REORGANIZE clause is no longer required in front of each reorganized structure. The DASDL compiler determines the changes that have been made to the reorganized structure. Though the REORGANIZE clause is no longer necessary, the old syntax is still valid. If used, however, a warning message is issued to indicate that the REORGANIZE clause is not needed. In addition, if a REORGANIZE clause appears in front of a structure, the structure is treated as a reorganized structure even if no changes were made. If a REORGANIZE clause is specified on structures having POPULATION specified, the AREASIZE and BLOCKSIZE assignments are recalculated. |
|
<record description>, <data set logical option>, <data set physical options> |
These clauses are discussed later in this section. |
The following examples illustrate DASDL syntax that includes data set declarations.
Example 1
The data set is named PROJECTS. And CURRENT PROJECTS is a comment that describes the data set. Three items are contained in the record: PROJECT-ID, PROJECT-LEADER, and PROJECT-PERSONNEL. The PROJECT-PERSONNEL item can contain information for 30 individuals.
PROJECTS DATA SET "CURRENT PROJECTS" ( PROJECT-ID NUMBER(4); PROJECT-LEADER ALPHA(20); PROJECT-PERSONNEL ALPHA(20) OCCURS 30 TIMES; );
Example 2
The PERSONNEL data set contains the data items EMPLOYEE-NO, EMPLOYEE-NAME, EMPLOYEE-DEPT, and the embedded data set DEPENDENTS. The DEPENDENTS data set contains a record for each of the employees' dependents. Records are added to the DEPENDENTS data set only as they are needed; thus, some employee records can contain several DEPENDENTS records while others contain none. The data set physical option DISKPACK assigns the PERSONNEL data set to pack.
PERSONNEL DIRECT DATA SET ( EMPLOYEE-NO NUMBER(5); EMPLOYEE-NAME ALPHA(20); EMPLOYEE-DEPT NUMBER(3); DEPENDENTS UNORDERED DATA SET ( DEP-NAME ALPHA(20); DEP-AGE NUMBER(3); ); ) DISKPACK; FIND-PERSONNEL ACCESS TO PERSONNEL KEY IS EMPLOYEE-NO;