"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> wrote on 08/31/2016
01:56:19 PM:
Is there a way for a CL program to check whether a subsystem is up?
You can call an RPG service procedure from a CL program to get the
subsystem status. The following is jsut such an RPG service procedure
which I wrote.
* ============================================================== *
* Get the extended status of the named subsystem -- optionally, *
* the SBSI0200 subsystem description format can be returned. *
* Extended statuses are: *
* *ACTIVE The subsystem is running. *
* *ENDING An ENDSBS command has been issued for the *
* subsystem or an ENDSYS command has been issued,*
* but the subsystem is still running. *
* *INACTIVE The subsystem is not running. *
* *RESTRICTED An ENDSBS command for the controlling subsystem*
* an ENDSYS *ALL command or an ENDSYS command *
* has placed the controlling subsystem in a *
* restricted condition. *
* *STARTING A STRSBS command has been issued for the *
* subsystem, but it is still in the process of *
* being started. *
* ============================================================== *
P LRPUTL_GetSbsStatus...
P B Export
D PI 12a
D SbsName 10a const
D SbsLib 10a const options(*nopass:*omit)
D SbsDesc 32767a options(*varsize: *nopass)
* -------------------------------------------------------------- *
D Slib S 10a inz(*blanks)
D ObjDesc s 32767a
/free
if (SbsName <= *blanks); // if no subsystem name
return '*ERR-SBSNAME'; // indicate an error
endif;
if (%parms > 1
and %addr(SbsLib) <> *null
and SbsLib > *blanks); // if library parm supplied
Slib = SbsLib; // use it
endif;
callp IBMAPI_RtvSbsDesc( ObjDesc: %len(ObjDesc): 'SBSI0200'
: SbsName + Slib: ApiErrC);
if (ApiErrC.BytAvail > *zero); // if an error occurred
return '*ERR-' + ApiErrC.MsgId; // return the message id
endif;
QWDI0200 = %subst(ObjDesc: 1: %len(QWDI0200)); // map the header
if (%parms > 2); // pass back the full format?
if ((%len(QWDI0200) + (QWDSSE * QWDNBRS)) > %len(SbsDesc));
// pass back just the amount defined for the parameter
SbsDesc = %subst(ObjDesc: 1: %len(QWDI0200) + (QWDSSE * QWDNBRS
));
else;
// pass back just the amount returned by the api
%subst(SbsDesc: 1: %len(QWDI0200) + (QWDSSE * QWDNBRS))
= %subst(ObjDesc: 1: %len(QWDI0200) + (QWDSSE * QWDNBRS));
endif;
endif;
QWDRS = %subst(ObjDesc: QWDOFS + 1: QWDSSE); // map the subsystem
entry
return QWDSES; // return the subsystem status
/end-free
* -------------------------------------------------------------- *
P LRPUTL_GetSbsStatus...
P E
* ============================================================== *
Sincerely,
Dave Clark
As an Amazon Associate we earn from qualifying purchases.