Skip to content

Enumerations

Daniel Long edited this page Sep 24, 2026 · 2 revisions

Enumerations

DCL-ENUM defines a named set of constants. Each constant is a name and its value, as with DCL-C — Red 1; or Red CONST(1);. The value is required, and may be a number or a character literal. Use QUALIFIED so each value is accessed with the enum name as a prefix.

DCL-ENUM Color QUALIFIED;
  Red 1;
  Green 2;
  Blue 3;
END-ENUM;

DCL-ENUM Status QUALIFIED;
  IsOpen 'O';
  IsClosed 'C';
END-ENUM;

DCL-S paint INT(10);
paint = Color.Green;

SELECT;
  WHEN paint = Color.Red;
    DSPLY 'Red';
  WHEN paint = Color.Green;
    DSPLY 'Green';
  WHEN paint = Color.Blue;
    DSPLY 'Blue';
ENDSL;

// IN tests a value against every constant of the enum
IF paint IN Color;
  DSPLY 'A color';
ENDIF;

Clone this wiki locally