Switch-Status Condition

MF nine

COBOL switches

MF named respectively SWITCH-0 through SWITCH-8.

The value of each of these switches ("on" or "off" ) is set by the operator at the start of execution of the COBOL run unit. (See the discussion of RTS switches in your COBOL system documentation for details.) The switch and the "on" or "off" value associated with the condition must be named in the Special-Names paragraph of the Environment Division described earlier in this chapter; see the topic The Special-Names Paragraph.

General Format


*

Comments:

The result of the test is true if the switch is set to the specified position corresponding to the condition-name.

If the compiler directive SWITCH-TYPE is set to 1, which is the default, it is only possible to use the Switch-Status Condition to test if a COBOL switch is set from within the runtime element that set the switch.

If the compiler directive SWITCH-TYPE is set to 2, which is set by the compiler when the compiler directive DIALECT is set to ISO2000, it is possible to use the Switch-Status Condition to test if a COBOL switch is set from within any runtime element of the run unit.