|
On 3/2/21 11:47 AM, Scott Klement wrote:
Literally... this is all you have to do to check if a subsystem is active:
DCL VAR(&SBS) TYPE(*CHAR) LEN(20) VALUE('QSYS QINTER')
DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(80)
DCL VAR(&RCVVARLEN) TYPE(*INT) LEN( 4) VALUE(80)
DCL VAR(&STATUS) TYPE(*CHAR) LEN(10)
CALL PGM(QWDRSBSD) PARM(&RCVVAR &RCVVARLEN SBSI0100 &SBS +
X'0000000000000000')
CHGVAR VAR(&STATUS) VALUE(%SST(&RCVVAR 29 10))
For lack of anything better to do at the moment, I've been trying to put the above into a utility, since it's not the first time (and probably won't be the last) that I'll have a situation where it would be nice if a CL program could check the status of a subsystem.
So (with a slight change in Scott's code, to cover the fact that I'm compiling it under V4R4), I ended up with this:
RTVSBSSTS CL program:
PGM PARM(&SBS &STATUS) DCL VAR(&SBS) TYPE(*CHAR) LEN(20) DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(80) DCL VAR(&RCVVARLEN) TYPE(*CHAR) LEN(4) VALUE(X'0050') DCL VAR(&STATUS) TYPE(*CHAR) LEN(10) CALL PGM(QWDRSBSD) PARM(&RCVVAR &RCVVARLEN SBSI0100 &SBS + X'0000000000000000') CHGVAR VAR(&STATUS) VALUE(%SST(&RCVVAR 29 10)) RETURN
and its CMD front-end:
CMD PROMPT('Retrieve Subsystem Status') PARM KWD(SBSNAME) TYPE(QNAME) MIN(1) + PROMPT('Subsystem Name') PARM KWD(STATUS) TYPE(*CHAR) LEN(10) RTNVAL(*YES) +
MIN(1) PROMPT(STATUS) QNAME: QUAL TYPE(*NAME) LEN(10) EXPR(*YES) QUAL TYPE(*NAME) LEN(10) EXPR(*YES) + DFT(*LIBL) + SPCVAL(*LIBL) + PROMPT('Library')
And a test program to exercise it:
PGM PARM(&SBS) DCL VAR(&SBS) TYPE(*CHAR) LEN(20) DCL VAR(&STATUS) TYPE(*CHAR) LEN(10) + VALUE('$$$$$$$$$$') RTVSBSSTS SBSNAME(%SST(&SBS 11 10)/%SST(&SBS 1 10)) +
STATUS(&STATUS) SNDPGMMSG MSG(&STATUS)
and its CMD front-end:
CMD PROMPT('Retrieve Subsystem Status')
PARM KWD(SBSNAME) TYPE(QNAME) MIN(1) + PROMPT('Subsystem Name') QNAME: QUAL TYPE(*NAME) LEN(10) QUAL TYPE(*NAME) LEN(10) + DFT(*LIBL) + SPCVAL(*LIBL) + PROMPT('Library')
But when I then call the command
TEST03MR21 SBSNAME(QBASE)
RTVSBSSTS retrieves the status fine, but then throws a CPF9872 on QCLRTNE, with reason code 2 (apparently some sort of null pointer error).
Now, if I've ever written a CL program to return a value in a parameter, it's been a long time since I've done it. What am I doing wrong here?
--
JHHL
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.