I have written a program which may be called by a command validation
program (or other program) to determine the name of the calling command.
This technique uses the QMHRTVRQ API to retrieve the last *RQS message
(similar to what Simon Coulter described with RCVMSG).

Basically, the following gives you the last request message, which
contains the last command executed:

/*** API variables ***/
DCL        VAR(&APIDTAFMT) TYPE(*CHAR) LEN(8) +        
             VALUE('RTVQ0100') /* API data formt */    
DCL        VAR(&APIDTALEN) TYPE(*CHAR) LEN(4) +        
             VALUE(X'000007D0') /* API data length:  + 
             2000 */                                   
DCL        VAR(&APIDTARTV) TYPE(*CHAR) LEN(2000) /* +  
             Retrieved API data */                     
DCL        VAR(&APIERRCD) TYPE(*CHAR) LEN(4) +         
             VALUE(X'00000000') /* API error code (no +
             data returned) */                         
DCL        VAR(&APILEN) TYPE(*CHAR) LEN(4) /* Data +   
             length returned */                        
DCL        VAR(&APIMSGKEY) TYPE(*CHAR) LEN(4) +        
             VALUE('    ') /* No message key */        
DCL        VAR(&APIMSGTYP) TYPE(*CHAR) LEN(10) +       
             VALUE('*LAST') /* Request message type */ 

/*** Retrieve info on last request message ***/

This technique has worked well for me.  I'll let you decide whether it
fits the simple and elegant litmus test.  Let me know if you'd like the
complete source program - I'll be happy to make it available to the

Jerry Jewel

Better living through fine code and hot coffee!
Email: jerry.jewel@nissan-usa.com
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com

This thread ...

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