![]() |
![]() |
![]() |
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.
01 レベルの記述項の例:
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.
列挙のサンプルも参照。このサンプルは、[スタート > すべてのプログラム > Micro Focus Visual COBOL > Samples]、 の場合JVM COBOL 言語リファレンスの場合 (Windows) または $COBDIR/demo (UNIX)。 に用意されている。
enum-header の後には、次の規則に従う 1 つ以上のフィールド定義が続く。
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