Restriction: These switches are supported for native COBOL only.
You can specify programmable and general run-time switches using the following methods:
- In the IDE
- Set programmable switch values in the project's
properties within the IDE. The values set here are built into your application and are always used as the defaults when the application
is run. You can override the defaults when running the application using one of the other following methods.
- Using environment variables
- Use the environment variables COBSW and OOSW (for switches for object-oriented programs) to set or override the switch values
when the application is started.
Note: We recommend that for switches affecting file handling, you do not use COBSW, but edit the file handler configuration file
(extfh.cfg) instead.
-
The following command sets the programmable switches 1 and 4 on, and all the others (2, 3, 5-8) are off by default:
- On the command line
- Specify switches on the command line when you start the application. Switch set here take precedence over those in the environment
variable (COBSW).
-
In the following example, the command loads the program
myprog with programmable switches 5 and 7 on and switch 2 off, and all the others (0, 1, 3, 4, 6 and 8) are off by default. Note
that switch 7 is turned on, since the last setting of it (that is +7) is the one used.
cobrun -2+5-7+7 ./myprog.int
Note: On UNIX platforms, you can only set switches on the command line when using the
cobrun command, and so limits the use to
.int,
.gnt, or
.so files.