Context:
Program Structure Types
![]() |
![]() |
![]() |
enum-id Action. 78 #Start. *> Start is a reserved word so use '#' symbol 78 #Stop. 78 #Rewind. 78 #Forward. end enum. enum-id Status. 78 Flunk value 50. 78 Pass value 70. 78 Excel value 90. end enum. class-id MainClass. method-id main static. declare a = type Action::Stop if a not = type Action::Start display a & " is " & a as binary-long *> Prints "Stop is 1" end-if display type Status::Pass as binary-long *> prints 70 display type Status::Pass *> prints "Pass" end method. end class.
An example with 01 level entries:
enum-id Permission. 01 #Execute value 1 b-left 0. 01 #Write value 1 b-left 1. 01 #Read value 1 b-left 2. end enum.
See also the Enums sample, available from Start > All Programs > Micro Focus Visual COBOL > Samples , under Language Reference for JVM COBOL (Windows) or $COBDIR/demo (UNIX).
The enum-header is followed by one or more field definitions which obey the following rules:
enum-id E1. 78 #Zero. 78 One. end enum. program-id x. display type E1::Zero display type E1::One perform varying auto e through type E1::values display e end-perform