CBL_SUBSYSTEM

Declares or deallocates subsystems.

Restriction: This routine is supported for native COBOL only.

Syntax:

call "CBL_SUBSYSTEM" using     function-code
                               parameter
                     returning status-code

Parameters

function-code
Call prototype: cblt-x1-compx
Picture: pic x comp-x.
Contains one of the following:

0: Declare subsystem

1: Cancel subsystem

2: Remove from subsystem

parameter
Group predefined as cblt-subsys-params containing:
01 cblt-subsys-params     typedef.
  03 cblte-ssp-handle     cblt-x2-compx. *> pic x(2) comp-x.
  03 cblte-ssp-name-len   cblt-x2-compx. *> pic x(2) comp-x.
  03 cblte-ssp-name       cblt-x1.       *> Occurs depending on
                                         *> cblte-ssp-name-len. pic x(n).
status-code
See Library Routines - Key.

On Entry:

function-code
The subfunction number.
With function-code = 0:
cblte-ssp-name-len
The length of subsystem program-name field.
cblte-ssp-name
The subsystem program-name (space-terminated).
With function-code = 1:
cblte-ssp-handle
The subsystem handle returned by a function 0 call.
With function-code = 2:
dummy-param
Value 0.

On Exit:

With function-code = 0:
cblte-ssp-handle
The subsystem handle.

Comments:

A subsystem is defined to be a specified COBOL program in an application, plus any subprograms subsequently called by programs already in the subsystem that do not already belong to any other subsystems.

With function-code = 0:
This function declares a subsystem. The routine returns a subsystem handle. If the program is not already loaded, the function loads it. If an error occurs in finding or loading the program, a subsystem handle of zero is returned.
A program belonging to a subsystem is only deallocated (that is, deleted from memory), when either it is canceled by the CANCEL verb, or the program cancels the entire subsystem using function-code=1, or the application executes a STOP RUN or CHAIN statement. The main program of a subsystem should not be canceled with the CANCEL statement unless all other programs in the subsystem have already been canceled. Any imported .dll files are automatically removed from memory when the .dll file which imports them is cancelled.
If the program is a .dll file, it must have been called previously if it is to be used to declare a subsystem.
With function-code = 1:
This function cancels all programs in the specified subsystem. On UNIX, the default cancel mode is physical cancel, which can be changed with the subsystem_cancel_mode run-time tunable.
If any program in the subsystem is still active, that program is released from the subsystem and is not canceled. Any imported .dll files are automatically removed from memory when the .dll file which imports them is cancelled.
With function-code = 2:
This function removes the program that called it from any subsystem the program is in. To ensure a program is never included in any subsystem, call this function at the start of each entry in to the program.