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



Hello Peter,

You wrote:
>CLRPFM FILE(MYLIB/MYFILE)

>Is this valid?
>MONMSG     MSGID(CPF0000) EXEC(DO)
>RCVMSG     MSGTYPE(*COMP) MSGDTA(&MSGDTA) MSGID(&MSGID)
>SNDPGMMSG  MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
>             MSGTYPE(*COMP)
>ENDDO

Not valid!

        1. You can't monitor for a completion message so the code in the DO
group will only run if an exception occurs.
        2. If an exception occurs the message won't be a completion message
        3. You can't reliably receive a *COMP message anyway because
receiving a non-exception message gets the first one which may not be from
the CLRPFM.

>What am I doing wrong?

Simply do the RCVMSG and SNDPGMMSG in-line for completion messages.

Receive the *LAST message after the CLRPFM which will get you the
completion message.  For example:

CLRPFM FILE(MYLIB/MYFILE)
RCVMSG     MSGTYPE(*LAST) MSGDTA(&MSGDTA) MSGID(&MSGID)
SNDPGMMSG  MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
             MSGTYPE(*COMP)

Let your global MONMSG handle any exceptions.  If you must handle
exceptions on the CLRPFM *and* forward the completion message then do:

CLRPFM FILE(MYLIB/MYFILE)
MONMSG     MSGID(CPF0000) EXEC(DO)
        /* Whatever recovery you need */
        GOTO SKIP_COMP
ENDDO
RCVMSG     MSGTYPE(*LAST) MSGDTA(&MSGDTA) MSGID(&MSGID)
SNDPGMMSG  MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +
             MSGTYPE(*COMP)
SKIP_COMP:


Regards,
Simon Coulter.

--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists
   http://www.flybynight.com.au/

   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175   mailto: shc@flybynight.com.au   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



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.