From: John McKee To: Ernie Malaga
I would like to gain access to data returned from RTVUSRPRF and related commands. How can this be done? My initial feeling is that it doesn't work, but I'm not a guru on AS/400. I would appreciate any help.
From: Ernie Malaga To: John McKee
RTVxxx commands retrieve information and place it in CL program variables only. You cannot run RTVxxx commands from RPG programs (except a few like RTVCLSRC, which don't retrieve data, but other things).
For this reason, you must run the RTVxxx commands from a CL program. If you need the information in an RPG program, call the CL program from the RPG and let the CL program run the RTVxxx command, passing the data back to the RPG program.
For example, if you wanted to run RTVUSRPRF to retrieve a user's message queue name (and the library where that message queue resides), use the code illustrated in 10 (page 76).
For example, if you wanted to run RTVUSRPRF to retrieve a user's message queue name (and the library where that message queue resides), use the code illustrated in Figure 10 (page 76).
The CL program uses the CHKOBJ command to check the existence of the user profile name you're supplying in the &USRPRF variable. If not found, CHKOBJ issues CPF9801 which is trapped by the MONMSG. In this case, parameter &MSGQ is given the value '*ERROR' which is then passed back to the RPG program (and you can detect it there). If the user profile is found, the RTVUSRPRF command is executed--returning to the RPG program the names of the message queue and message queue library.
I think the RTVxxx commands can be executed in REXX procedures too, but I don't know enough about REXX to give you a straightforward answer. Hope this helps.
TechTalk: Using the RTV Commands
Figure 10 Retrieving values from a RTV command
Figure 10: Retrieving Values From a RTV Command The RPG Program CALL 'RTVMSGQ' PARM USRPRF 10 PARM MSGQ 10 PARM MSGQLB 10 The CL program: RTVMSGQ: PGM PARM(&USRPRF &MSGQ &MSGQLIB) DCL VAR(&USRPRF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGQ) TYPE(*CHAR) LEN(10) DCL VAR(&MSGQLIB) TYPE(*CHAR) LEN(10) CHKOBJ OBJ(&USRPRF) OBJTYPE(*USRPRF) MONMSG MSGID(CPF9801) EXEC(DO) CHGVAR VAR(&MSGQ) VALUE('*ERROR') RETURN ENDDO RTVUSRPRF USRPRF(&USRPRF) MSGQ(&MSGQ) + MSGQLIB(&MSGQLIB) ENDPGM
LATEST COMMENTS
MC Press Online