TechTalk: Using the RTV Commands

CL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: