The following four examples show how to define a database using the DASDL language.
Example 1
The database in this example consists of a single data set named PERSONNEL. The data set contains four data items: NAME, EMPLOYEE-NO, DEPARTMENT, and PHONE.
PERSONNEL DATA SET ( NAME ALPHA(30); EMPLOYEE-NO NUMBER(6); DEPARTMENT ALPHA(20); PHONE NUMBER(10); );
Example 2
In this example, the database consists of a single data set and two sets. The PERSONNEL data set can be accessed by NAME using the FIND-BY-NAME set, and it can be accessed by EMPLOYEE-NO using the FIND-BY-NUMBER set.
PERSONNEL DATA SET ( NAME ALPHA(30); EMPLOYEE-NO NUMBER(6); DEPARTMENT ALPHA(20); PHONE NUMBER(10); ); FIND-BY-NAME SET OF PERSONNEL KEY IS NAME; FIND-BY-NUMBER SET OF PERSONNEL KEY IS EMPLOYEE-NO;
Example 3
In this example, the database uses the STATISTICS option to measure database usage. The ALLOWEDCORE parameter controls how much core can be used for database buffers. The POP-OF-PERSONNEL global item is maintained by the system. It contains a count of the number of records in the PERSONNEL data set.
OPTIONS (STATISTICS); PARAMETERS (ALLOWEDCORE = 18000); POP-OF-PERSONNEL POPULATION(9999) OF PERSONNEL; PERSONNEL DATA SET ( NAME ALPHA(30); EMPLOYEE-NO NUMBER(6); DEPARTMENT ALPHA(20); PHONE NUMBER(10); );
Example 4
In this example, the database includes a restart data set containing restart information for user application programs. The physical specification for the PERSONNEL data set assigns the data set to pack and allocates two buffers for it.
OPTIONS (AUDIT); RESTARTDS RESTART DATA SET ( R-PROGRAMNAME ALPHA(25); R-USERINFO ALPHA(250); ); PERSONNEL DATA SET ( NAME ALPHA(30); EMPLOYEE-NO NUMBER(6); DEPARTMENT ALPHA(20); PHONE NUMBER(10); ); FIND-BY-NAME SET OF PERSONNEL KEY IS NAME; FIND-BY-NUMBER SET OF PERSONNEL KEY IS EMPLOYEE-NO; PERSONNEL (KIND = PACK, BUFFERS = 2);