SWITCH-TYPE

Makes programmable switches behave in the same way as in the ISO 2002 standard.

Syntax:

>>-.---.-.----.--SWITCH-TYPE--"integer"-------------------><
   +-/-+ +-NO-+

Parameters:

integer
One of:
1
Behavior of this COBOL system
2
ISO 2002 behavior
3
Siemens BS2000 COBOL behavior

Properties:

Default: SWITCH-TYPE"1"
Phase: Syntax check
$SET: Any

Comments:

In the ISO 2002 standard, and the Siemens BS2000 COBOL dialect, switches persist and are visible throughout a run unit. For example, if program A calls program B then any changes to the switches in A are visible when B is called, and any changes made in B are visible in A when control returns to A. If, however, A terminates and B is called, then the changes made by A are lost. The space in which the switches are stored can be regarded as common to all programs in a run unit; hence changes to the switches are visible to all programs.

In this COBOL system, and older versions of Micro Focus COBOL, any called subprogram (in this case B) has its own set of COBOL switches independent of any other program. If program A calls program B, program B's switches are set to the same values as A's were at program start - ignoring any changes A might have made to the switches. When control returns to program A, A's switches are exactly the same as they were before program control changed - ignoring any changes B might have made to the switches. B's switches are preserved (unless it is canceled), so that if invoked again its own switches are set as when it called A. In this case, the space in which switches are stored can be regarded as unique to each program.

SWITCH-TYPE"3" supports the Siemens BS2000 COBOL TSW-n and USW-n switches.

You should only use SWITCH-TYPE"3" when the BS/2000 add-on is present to provide the necessary run-time support.