h
Ian and James,

Re: MsgKey CHAR(4)

There are two ways to monitor a message queue.

1/ Write a break handling program.

2/ Write a program to receive messages.

The techniques are similar but the interface is different.  A break
handling program must accept three parameters:
        CHAR(10) message queue
        CHAR(10) message queue library
        CHAR(4) message key
The break handling program is attached to the message queue using the
CHGMSGQ command and it MUST receive the message that caused it to break
else it receives CPF2506.  A break handling program does not generally wait
to receive messages.  It is automatically invoked by the OS when a message
that equals or exceeds the break severity arrives on the message queue.
Once it processes the message that caused it to break it simply exits.  The
OS will call it again if another message causes the queue to break.  (It
gets a little more complex if you want to handle messages that arrive while
you are processing one of them.)

A receive message program does not require parameters and it generally
issues a RCVMSG command with a *MAX or specific wait period.  It also
generally loops back to the RCVMSG after processing the message.  It
generally does not use a message key because it has no way of knowing what
that is (at least until it has received the first message).

James' sample code looked like a receive message program rather than a
break handling program.  Examples of each and a discussion can be found in
the CL Programmer's Guide in Chapter 8.

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» 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.