Previous Topic Next topic Print topic


Enumeration - in COBOL and

Enumeration in Managed COBOL

enum-id Action public.
working-storage section. 
01 binary-long.         *> Underlying type for the enum. 
                        *> binary-long is the default
    78 Starter value 0. *> Declare enum values as level-78 items
    78 Stop    value 1.
    78 Rewind  value 2.
    78 Forward value 3.
end enum. 
*> Short hand version of above.
*> PUBLIC and BINARY-LONG are the defaults
*> The default values are 0 1 2...
enum-id Action.
   78 Starter.  
   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.
program-id main.
   display type Status::Pass as binary-long *> prints 70
   display type Status::Pass                *> prints Pass
end program. 
Previous Topic Next topic Print topic