A switch-status condition tests the value of one of the external program switches. Program switches can be set at the command line when the program is run, or may be set with the SET verb. By default, each switch is initially set to "off".
The STATUS clause of the SPECIAL-NAMES paragraph associates a switch-status name with either the on or off setting of a particular switch. When a switch is set, the corresponding ON STATUS name is true and the OFF STATUS name is false. When the switch is reset, the reverse is true. In a conditional expression, you can test a switch's on/off status by simply specifying the desired switch-status name.
An example of code involving switches follows:
identification division. program-id. testit. environment division. special-names. switch 1 is switch-1 on status is first-on off status is first-off switch 2 is switch-2 on status is second-on off status is second-off switch 3 is switch-3 on status is third-on off status is third-off data division. procedure division. main. display window erase. set switch 3 to off. if first-on display "First Switch On. . ." line 5 col 4 else display "First Switch Off. . ." line 5 col 4. if second-on display "Second Switch On. . ." line 7 col 4 else display "Second Switch Off. . ." line 7 col 4. if third-on display "Third Switch On. . ." line 9 col 4 else display "Third Switch Off. . ." line 9 col 4. accept omitted. stop run.