× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi, Rob:

It seems to me the "best simple" solution is to issue:

   ALCOBJ   OBJ((*LIBL/EXCLEIACT *DTAQ *SHRRD))

in the "listener" program that reads from the data queue. Then, your logic below should work.

Cheers,

Mark S. Waterbury

> rob@xxxxxxxxx wrote:
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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.