On 13/06/2008, at 12:42 AM, beppecosta wrote:
CPI9200 and CPI9153 are sent to the RPG procedure that opens the  
file and I can remove them with QMHRCVPM directly from the RPG  
immediately after the file is opened.
Yes, it's easy when the messages are sent to the caller.
However CPI9150 is sent to QTSMGAFT pgm and CPI9151 to QCNSRDDM pgm  
that are resent by these IBM modules when they complete.
So they are associated with call stack entries that are no longer  
active. That's harder to deal with.
I've tried with different stack counter values, message type, etc.  
but these two messages still remain in the job log.
The only way to get at these messages is via the 4-byte Message Key  
of the message.
Any other suggestion ?
You could use either the List Job Log Messages (QMHLJOBL) API or the  
Open List of Job Log Messages (QGYOLJBL) API. Iterate over the list  
from the end removing any unnecessary messages. You'd need to send a  
marker message so you could determine when to stop.
You could use the Receive Program Message (QMHRCVPM) API or Remove  
Program Message (QMHRMVPM) API (or the corresponding CL commands) to  
remove messages by message key. You'd need to know the key and since  
you don't have that information available you'd have to guess.  
Simplest is probably to send a marker message and save the key before  
starting the application process, send another marker message and  
save the key at the end of the process, then generate message markers  
between those two saved values and attempt to remove a message with  
that key. Monitor and handle CPF2410 because not all message keys  
will have an associated message.
The message marker is simply a 4-byte hexadecimal value so by mapping  
it to a 4-byte integer you can easily increment between the low mark  
and high mark.
Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         OS/400, i5/OS Technical Specialists
   
http://www.flybynight.com.au/
   Phone: +61 2 6657 8251   Mobile: +61 0411 091 400        /"\
   Fax:   +61 2 6657 8251                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------
 
As an Amazon Associate we earn from qualifying purchases.