Switches
P3/COBOL implements environmental switches accessible by the COBOL application using the standard phrases
in the SPECIAL NAMES paragraph in the CONFIGURATION SECTION.
Switch Names
The switch names available to the COBOL programmer are:
SWITCH-0throughSWITCH-8, andUSPI-0throughUSPI-7TSW-0throughTSW-31USW-0throughUSW-31SYSTEM-SHUTDOWN
These switch settings are maintained in the P3/COBOL Run Unit and can be set by the runtime.p3c configuration file, as well as dynamically manipulated by the COBOL program according to the standard rules regarding switches (i.e., mnemonic names and conditional variables).
Setting Switches
To set switches in the configuration file that will be visible to all programs running under the configured run unit, use the following entry:
<switch-settings>
<switch>
<name>switch-name</name>
<setting>switch_setting</setting>
</switch>
</switch-settings>Where:
{switch-name} is SWITCH-1 ... SWITCH-8 or USPI-0 ... USPI-7
{switch-setting} is:
| Switch Setting | Description |
|---|---|
ON | Initial state of switch is set to ON |
OFF | Initial state is switch set to OFF |
WIRED_ON | The switch is set to ON and made immutable |
WIRED_OFF | The switch is set to OFF and made immutable |
NC | The switch value is not set until programmatically set |
WIRED_ON and WIRED_OFF determine the immutable state of the switch
(the switch cannot be changed by the
application program)
This is an example configuration file that sets switches.
<p3-runtime-options>
<program-package>programs</program-package>
<byte-order>BIG_ENDIAN</byte-order>
<switch-setting>
<switch>
<name>SWITCH_1</name>
<setting>ON</setting>
</switch>
<switch>
<name>SWITCH_3</name>
<setting>WIRED_OFF</setting>
</switch>
</switch-setting>
</p3-runtime-options>In this case, SWITCH-1 is set ON initially, and can be changed by the program and SWITCH-3 is set OFF and cannot
be changed by the program.