CBL_SUBSYSTEM

Declares or deallocates subsystems.

Syntax:
call "CBL_SUBSYSTEM" using     function-code
                               parameter
                     returning status-code
Parameters:
Using call prototype (see Library Routines - Key) Picture (32-bit systems)
function-code cblt-x1-compx. pic x comp-x.
Contains one of the following subfunction numbers:
0 Declare subsystem
1 Cancel subsystem
2 Remove from subsystem
With function-code = 0:
parameter Group predefined as cblt-susys-params containing: Group containing:
  cblte-ssp-handle   cblt-x2-compx   pic x(2) comp-x.
  cblte-ssp-name-len   cblt-x2-compx   pic x(2) comp-x.
  ss-name   cblt-x1 occurs depending on cblte-ssp-name-len   pic x(n).
With function-code = 1:
parameter cblt-x2-compx pic x(2) comp-x.
With function-code = 2:
parameter cblt-x2-compx value 0. pic x(2) comp-x value 0.
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. 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.

See Also: