TechTalk: Retrieve the OS Level in CL

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

Q: How can I retrieve the system operating level from within a CLP? I need to put it into a variable to test against.

- Charles Robertson Dallas, TX This email address is being protected from spambots. You need JavaScript enabled to view it.
A: Use the Retrieve Object Description (RTVOBJD) command to get information about the QCMD program, as in Figure 5. On my V3R7 system, this returns "V03R07M00."

- Derek Butland A: Though there are many indirect ways to find the operating system level of an AS/400, the supported approach is to use the Retrieve Product Information (QSZRTVPR) API documented in the Software Products chapter of the System API Reference manual (SC41-4800, CD-ROM QBJAVC00). By using special values of *OPSYS for Product ID and *CUR for Release Level, you need to know only that you are running on an AS/400 at V2R3 or later.

Figure 6 illustrates how to use this API. -BruceVining

Figure 5: One way to determine the system release level

DCL VAR(&SYSLVL) TYPE(*CHAR) LEN(9)
RTVOBJD OBJ(QSYS/QCMD) OBJTYPE(*PGM) SYSLVL(&SYSLVL)

DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(256)
DCL VAR(&RELEASE) TYPE(*CHAR) LEN(6)
CALL PGM(QSZRTVPR) PARM(&RCVVAR X'00000100' +

Figure 6: Another way to determine the system release level

'PRDR0100' '*OPSYS *CUR 0000*CODE ' +
X'00000000')

CHGVAR VAR(&RELEASE) VALUE(%SST(&RCVVAR 20 6))

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$