× 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.



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I want to count how many times that a message appears in a job log of a
currently running job.  I am trying the following program with no luck.

If I use *PRV it finds no messages.
If I use *EXT instead of *PRV it finds some of the messages.  But not the
ones that I am looking for.

PGM (                                                                +
      &SEARCHMSG       /* Message to count                        */ +
      &MSGCOUNT        /* Count of messages which appeared        */ +
    )

    DCL  &APOS        *CHAR   1  /* Apostrophe                       */
    DCL  &MSGCOUNT    *DEC    3  /* Count of message occurance       */
    DCL  &MSGID       *CHAR   7  /* Message id from stack            */
    DCL  &MSGKEY      *CHAR   4  /* Key of message from stack        */
    DCL  &SEARCHMSG   *CHAR   7  /* Message to count                 */

             CHGVAR     VAR(&APOS) VALUE(X'7D')
             CHGVAR     VAR(&MSGCOUNT) VALUE(0)

    /*     +
     | Position to top of job message queue     +
    */
             RCVMSG     PGMQ(*PRV) MSGQ(*PGMQ) MSGTYPE(*NEXT) MSGKEY(*TOP)
+
                          RMV(*NO) KEYVAR(&MSGKEY) MSGID(&MSGID)
             MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(END))

NEXT:

             IF         (&MSGID=&SEARCHMSG) DO
              CHGVAR &MSGCOUNT VALUE(&MSGCOUNT + 1)
             ENDDO

    /*     +
     | Get next message     +
    */
             RCVMSG     PGMQ(*PRV) MSGQ(*PGMQ) MSGTYPE(*NEXT)
MSGKEY(&MSGKEY) +
                          RMV(*NO) KEYVAR(&MSGKEY) MSGID(&MSGID)
             MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(END))

             GOTO       NEXT
END:

             ENDPGM

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.