On 12/08/2008, at 7:24 AM, Jose Santana wrote:

I have an Rpg program that makes a call to a command from an CMS
application to
checkout some objects under certain circumstances. My RPG program
monitors for
any errors on the call to the checkout command in the event that an
object cannot be
checked out for some reason beyond its control. However, when I try to
capture the
error I'm only getting the "program CHECKOUT ended Abnormally" message
that's
issued by the called command but it is not capturing the preceding
CPF2469 escape message.
This escape message then causes the main program MYPGM to crash. Here's
a snippet
of my code:

c monitor
c call 'QCMDEXC'
c parm CmdStr
c parm CmdLen
c endif
c dow 1=1
c callp ReceiveMsg(Msg0200
c : %size(Msg0200)
c : 'RCVM0200'
c : '*'
c : 0
c : '*LAST'
c : *blanks
c : 1
c : '*REMOVE'
c : ApiError)
*ReceiveMsg makes a call to the QMHRCVPM
c if Msg0200.BytesAvail = 0
c Leave
c endif
c callp LogMessage
c enddo
c endmon

Can anyone please shed some light as to what I might be missing. Aren't
all messages
thown by the QCMDEXC call supposed to be captured by the calling
program's Monitor /End-mon block?
Any help is greatly appreciated.

I find this problem so poorly described I have difficulty determining what you mean. If I understand you correctly then your program crashes because of CPF2469 which is "Error occurred when sending message&1."

If this is a "preceding" error message then **IT** cannot be crashing your program because it was (likely) sent to another program (probably the one you invoked to perform the CHECKOUT). If it was sent to you then it can't be a "preceding" error message.

From your description I infer that the call stack looks something like:

YOUR_PGM
QCMDEXC
CHECKOUT

Then CHECKOUT fails and sends "program CHECKOUT ended Abnormally"

If it ended abnormally then QCMDEXC would catch any exceptions sent by CHECKOUT and would in turn send some sort of "Error occurred on command" message.

None of which seems related to the CPF2469 message you say crashes your program. Given that CPF2469 indicates a problem when SENDING a message perhaps the problem is within your LogMessage procedure?

Where, exactly, does your program crash? What are the last 5 or so messages in the job log when the crash occurs? Include the "From program" and "To program" information from the messages.


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 / \
--------------------------------------------------------------------




This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].