call "CBL_SUBSYSTEM" using     function-code
                     returning status-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

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).
See Library Routines - Key.

On Entry:

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

On Exit:

With function-code = 0:
The subsystem handle.


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. 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.