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



On 21-Feb-2014 16:59 -0800, James H. H. Lampert wrote:
Here's the scenario:

I'm calling Scott Klement's JDBCR4 service program (actually, my own
expanded version thereof, but...). I try to connect to a system that
rejects the connection. A procedure in the service program puts a
diagnostic message in the joblog, a CPF9897 with the text (at least
in the version of the scenario I can readily reproduce) "The
application server rejected the connection. (General security
error.)"

I want to be able to retrieve and display this diagnostic from the
program (ILE RPG, FWIW, but this is presumably a system API
question, not an RPG question) that called JDBCR4.

If F9 the message, I get (and JDBCR4QV is my expanded JDBCR4):

From program . . . . . . . . . : JDBCR4QV
From library . . . . . . . . : AQUESTVIEW
From module . . . . . . . . : JDBCR4
From procedure . . . . . . . : JNI_CHECKERROR
From statement . . . . . . . : 7209

To program . . . . . . . . . . : JDBCR4QV
To library . . . . . . . . . : AQUESTVIEW
To module . . . . . . . . . : JDBCR4
To procedure . . . . . . . . : JNI_CHECKERROR
To statement . . . . . . . . : 7209

I can see the message by doing a DSPJOBLOG, but I can't figure out
how to make the calling program see it. Can I do so without further
modifications to my expanded JDBCR4?

If an application intends that the invoking program should be able to access the message, the application either should be sending [e.g. Resend Escape Message (QMHRSNEM) API or Send Program Message (QMHSNDPM) API or CL command (SNDPGMMSG)] directly to the invoker or moving the messages up-the-stack [Move Program Messages (QMHMOVPM) API]. When the application instead sends the messages only to the invoked procedure or program or only to the procedures within [i.e. to\within itself], then the access to those message from the invoker is difficult. There is a procedure documented to receive the messages; I could not easily locate a link. That method involves obtaining a message mark prior to the invocation of the application that does not /play well with others/, and then repeatedly invoke the Receive Program Message (QMHRCVPM) API or the CL command (RCVMSG) with a decremented message key value while also monitoring and handling [best to include the removal of] the conditions of "message key not found"; being a stand-alone procedure the procedure could globally monitor\ignore that exception, and then remove all messages in its queue upon completion, rather than RCVMSG RMV(*YES) after each instance of that exception.

If I had access to the source of the application that sends the messages, I would prefer to /correct/ that application to move the messages up to the invoker.

Hmmm... I had already found the link, in essence; i.e. the link was found at the bottom of the topic _Call message queue_ with the parent topic _Job message queues_ that I found by searching InfoCenter on the tokens:
receiving messages stack

<http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rbam6/msgcallqueue.htm>
IBM i 7.1 Information Center -> Programming -> Control language -> Messages -> Message queues -> Job message queues
_Call message queue_
"A call message queue is used to send messages between one program or procedure and another program or procedure.

As long as a program or procedure is on the call stack (has not returned yet), its call message queue is active and messages can be sent to that program or procedure. After the program or procedure returns, messages can no longer be sent to it. Message types which can be sent to a call message queue include informational, request, completion, diagnostic, status, escape, and notify.
...
Note: When you are using the command entry display, you can display all the messages sent to the job message queue by pressing F10 (Include detailed messages). After the messages are displayed, you can roll through them using one of the roll keys.

You can also display the messages for a job by using the Display Job Log (DSPJOBLOG) command.

Parent topic: _Job message queues_

Related tasks:
_Receiving a message from a program or procedure that has ended_
"


<http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rbam6/rcvmsgpgm.htm>
IBM i 7.1 Information Center -> Programming -> Control language -> Messages
_Receiving a message from a program or procedure that has ended_
"Occasionally, there is a need to receive messages from the job log that are sent to a call message queue that is no longer active.

For example, PGMA calls PGMB and PGMB sends a diagnostic message to itself and an escape message to PGMA. PGMA can easily receive the escape message that was sent to it, but sometimes it is necessary to also receive the diagnostic message. Because the diagnostic is on a call message queue that is no longer active, the message must be received by using a message reference key. This can be done, but it takes more work than one simple receive message command.
..."


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.