Previous Topic Next topic Print topic


Introduction to Switches

A switch is a parameter you pass to the run-time system to control the behavior of your program at run time. These switches fall into two categories:

Run-time switches
Run-time switches are acted on by the run-time system itself. Each consists of an upper-case or lower-case letter. These switches affect optional aspects of the behavior of certain COBOL features at run time.
Programmable switches
COBOL programmable switches are numbered from 0 to 8. Each can be set to "off" or "on" when your application is started. Their state can be read by your application at any time when it is running.

The switches must be defined using a condition name in the Special-Names paragraph. For example:

 special-names.
     switch-0 is job-origin on status is us-office
                            off status is uk-office
  ...
 procedure division.
     evaluate job-origin
      when us-office...
      when uk-office...
  ...
Previous Topic Next topic Print topic