|
Hi Rob, You could just get a list of active jobs using QUSLJOB, and see if the one in question is running... It is very fast and pretty easy. Regards, Rick
On Behalf Of rob@xxxxxxxxx Sent: Tuesday, February 20, 2007 7:58 AM To: midrange-l@xxxxxxxxxxxx Subject: data queue's and locks Problem: I want to send a *SHUTDOWN command to a data queue, but I do not want to do so, if the data queue job is already dead. Tried some simple little logic like PGM DCL &QNAME *CHAR 10 VALUE(EXCLEIACT) DCL &QLIB *CHAR 10 VALUE(*LIBL) DCL &QLEN *DEC 5 VALUE(9) DCL &QDATA *CHAR 9 VALUE('*SHUTDOWN') DCL &QWAIT *DEC 5 VALUE(0) /* Seconds to wait */ /* Check lock status.*/ ALCOBJ OBJ((&QLIB/&QNAME *DTAQ *EXCL)) WAIT(&qwait) MONMSG MSGID(CPF1002) EXEC(DO) /* Data queue in use therefore EXCLEIACT is running. */ RCVMSG MSGTYPE(*LAST) /* Clear the unable to allocate message from job queue */ /* Send the shutdown command */ CALL PGM(QSNDDTAQ) PARM(&QNAME &QLIB &QLEN &QDATA) ENDDO ENDPGM However there is no lock on the object even if the data queue reader job is at this call stack: Type Program 1 QCMD QSYS EXCLEIACT GDIHQ EXCLEIACT GDIHQ QRCVDTAQ QSYS So, I guess my options include: 1 - Modifying the reader program to do some sort of ALCOBJ to get this logic to work. 2 - Using the list jobs api to see if the EXCLEIACT job is running. 3 - Modifying the reader program to clear the data queue upon start (which may cause issues with other stacked up entries). Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com
As an Amazon Associate we earn from qualifying purchases.
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.