Setting Switches

Switches that you specify before running your program can be set using the COBSW environment variable. Alternatively, if you are running a dynamically loadable program, you can set them on the cobrun command line; however, we recommend that you use COBSW instead.

To set a programmable switch or run-time switch on, precede it with a plus sign (+); to set it off, precede it with a minus sign (-).

If you do not explicitly set any switches either in the COBSW environment variable or on the cobrun command line, then their default values apply.

The format for setting switches in COBSW is:


The format for setting switches on the command line is:


where the parameters are:

A programmable or run-time switch. The plus sign (+) sets the switch s on, while the minus sign (-) sets it off.

Either a programmable switch with a digit in the range 0 through 8, or a run-time switch with an upper-case or lower-case letter.
Note: You should note the following when setting switches:
  • Switches can be separated by spaces (but this is not required); however, there must not be a space between the sign ("+" or "-") and its associated switch
  • Switches can be specified in any order, but each programmable or alphabetic switch must be preceded by a sign
  • Individual switches can be set more than once, but the last setting of any particular switch is the one accepted by the system
  • Switches remain set when COBOL subprograms are called
  • Switches set on the command line take precedence over those defined in the COBSW environment variable
  • Switches are case sensitive.