Repository navigation
Enumerations
Daniel Long edited this page Sep 24, 2026
·
2 revisions
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;- Installation
- Quick Start
- CLI Reference
- Language Basics
- Data Types
- Variables and Constants
- Data Structures
- Arrays
- Varying-Dimension Arrays
- Control Flow
- Procedures
- Procedure Overloading
- Built-In Functions
- Error Handling
- Operation Extenders
- Enumerations
- Program Status Data Structure
- Data Areas
- SND-MSG
- Embedded SQL
- Record-Level Access
- Display Files (WORKSTN)
- Program-Described Files (I-Specs and O-Specs)
- DATA-INTO and DATA-GEN
- XML-INTO
- Fixed-Format Source
- Database Connections
- Multi-Module Programs
- Environment Variables
- Testing
- Complete Example: Employee Report
- IBM i Conformance Results
- IBM i Execution Results