× 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 27 Feb 2013 01:40, Tim Bronski wrote:
I'm trying to retrieve the actual command string of the the command
that was used to invoke my program - the CPP. Using QMHRCVPM or
RCVMSG I can retrieve the request message with the command string in
the message data but ONLY if the command is entered on a command
line.

The /command line/ is a request processor. The MSGTYPE(*LAST) received from the request processor will locate the /request message/ that invoked your program. No mention is made if that is how "I can retrieve" currently;;; Hmmm... just checked, and a later message in the thread seems to imply that the following request is being used:
rcvmsg pgmq(*prv) msgq(*pgmq) msgtype(*last) rtntype(&rt) msg(&msg)

If the command was invoked from a CLP there's nothing there.

If using MSGTYPE(*LAST) for the CL program that invoked your program, then that is correct. The invoking CLP did not send a message to effect the request, nor is there officially a request message in its program message queue, because the program is not a request processor.

I've looked up and down the stack. It's obviously around somewhere and
I could have sworn I've done this before.

If logging CLP is off [i.e. LOGCLPGM(*NO)], then no message is logged. If the logging for CLP is active, then the request message appears to be logged to the program message queue of the CLP; i.e. in DSPJOBLOG, the request will be visible with an /apparent/ program message queue of the CLP as invoker, sent from QCLCLCPR, as seen by F9=Message Details.

I do not think I ever learned how to receive that message from the *PGMQ of that CLP, thus why I say "apparent" in the above. But I do know that the logged request message can be obtained by a [decremented] key value, using the same technique used to obtain messages from programs no longer on the stack. Of course if CL logging was off for that request, then the request message eventually found using that technique, may not be the one actually being sought, and that could waste lots of resources having tried to learn that. I could code up and post an example if you want.

Anyone know what the difference is between the way a command is
processed in these two scenarios and where I might find my command?

I recall dealing with a similar question, soon after I first started learning CL. I do not recall exactly what I had been trying to do at the time; why I thought I needed that information. But IIRC, I ended up [learning how to, and then] coding a request processing program to deal with my issue.... because as alluded above, the difference is that in one case the prior invoker is the Request Processing Program, and in the other case the prior invoker is the CL run-time for the compiled CLP.

Several years later, when I learned about getting messages from inactive program message queues, I noticed that the request messages were being processed. Thus how I learned\know that they are available by message key, even if seemingly irretrievable by naming the CLP in the PGMQ() parameter.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.