I don't delete our QPADEV* devices. But I had a need to vary them back
on in a batch job nightly to support clients on an ASP server. I wrote
the small CL program below that produces an outfile of the QPADEV*
*DEVD, then checks their status using the QDCRCFGS API. If the status
equals 0 (varied off), the program executes the VRYCFG command.

<code>
/* Vary on all QPADEV* devices that are VARIED OFF */
/* Scott A. Schollenberger */
/* April 27, 2004 */

VRYQPADEV: PGM

/* DSPOBJD outfile */
DCLF FILE(QPADEVICES)

/* QDCRCFGS API variables */
DCL VAR(&RECVAR) TYPE(*CHAR) LEN(45) /* QDCRCFGS +
API receiver variable (short) */
DCL VAR(&RCVLEN) TYPE(*CHAR) LEN(4) /* Receiver +
variable length in binary */
DCL VAR(&LENGTH) TYPE(*DEC) LEN(9 0) VALUE(45) +
/* Receiver variable length in decimal */
DCL VAR(&CFGS0100) TYPE(*CHAR) LEN(8) +
VALUE('CFGS0100')
DCL VAR(&CFGTYPE) TYPE(*CHAR) LEN(10) +
VALUE('*DEVD') /* Configuration type = +
*LIND */
DCL VAR(&ERRCDE) TYPE(*CHAR) LEN(4) +
VALUE(X'00000000')
DCL VAR(&STSBIN) TYPE(*CHAR) LEN(4) /* Status in +
binary */
DCL VAR(&STATUS) TYPE(*DEC) LEN(9 0) /* Status +
in decimal */

/* Global monitors */
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR))

/* Create outfile of QPADEV* *DEVD virtual devices */
DSPOBJD OBJ(QPADEV*) OBJTYPE(*DEVD) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/QPADEVICES)

/* Read QPADEVICES file */
#READ: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(#EOF))

CHGVAR VAR(%BIN(&RCVLEN)) VALUE(&LENGTH)
CALL PGM(QDCRCFGS) PARM(&RECVAR &RCVLEN &CFGS0100 +
&CFGTYPE &ODOBNM &ERRCDE)
CHGVAR VAR(&STSBIN) VALUE(%SST(&RECVAR 9 4)) /* Get +
status */
CHGVAR VAR(&STATUS) VALUE(%BIN(&STSBIN)) /* Binary +
to decimal */

IF COND(&STATUS = 0) THEN(DO)
VRYCFG CFGOBJ(&ODOBNM) CFGTYPE(*DEV) STATUS(*ON)
MOVPGMMSG MSGTYPE(*COMP)
ENDDO

GOTO CMDLBL(#READ)

/* Clean up */
#EOF: CLOF OPNID(QPADEVICES)
MONMSG MSGID(CPF0000)
DLTOVR FILE(*ALL)
MONMSG MSGID(CPF0000)
RETURN

/***********************************************************************
*******/
/* E R R O R S
*/
/***********************************************************************
*******/


ERROR: MOVPGMMSG /* Move *DIAG messages up the program stack */

RSNESCMSG /* Resend *ESCAPE message up the program +
stack */
RETURN
ENDPGM
</code>




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.