Set Declaration Example

The following example illustrates the DASDL syntax for declaring sets:

EMPLOYEE DATA SET
 (
  NAME     ALPHA(20);
  EMP-NO   NUMBER(6);
  DEPT     FIELD(8);
  TITLE    ALPHA(15);
 );
BY-NAME SET OF EMPLOYEE
  KEY IS NAME,
  INDEX SEQUENTIAL;
BY-EMP-NO SET OF EMPLOYEE
  KEY IS EMP-NO,
  INDEX RANDOM;

BY-NAME orders the records of the EMPLOYEE data set using the key item NAME. BY‑EMP-NO orders the records in ascending sequence using the key item EMP-NO.