The $SUBSYS function determines the status of a subsystem. This function typically is used when designing applications through the Subsystem Management facility. You can use $SUBSYS to determine whether a subsystem is active before transferring control from one subsystem to another.
$SUBSYS takes a subsystem name as an argument and returns a value indicating the status of that subsystem
|Value||The subsystem is...|
|0||Not active (not started)|
|2||Draining (the STOP command has been issued and users are in the subsystem).|
|3||In test mode.|
|4||Draining (because a SUSPEND command was issued)|
The $SUBSYS function without an argument returns the name of the subsystem you are currently in. For example, the User Language statement:
%CURSYS = $SUBSYS
assigns the name of the current subsystem to %CURSYS, if executed within a subsystem, or returns null if at command level.
. . . TRANSFER: IF $SUBSYS('AUTOS') = 1 THEN . * * TRANSFER TO INSURANCE SUBSYSTEM * . . .