December 16

0 comments

How to retrieve IBMi (iSeries AS400) operating system version in a CLP program

By NickLitten

December 16, 2009

#snippet, #CLP, #OS, #version

Get the IBM i Operating System Version in IBM i CL

There are lots of way of checking the operating system version on your IBM i Server. On your command line type DSPSFWRSC and with F11 you will see the Software Version of all the products installed on your iSeries. You could also use the DSPPTF command to show the current release as well as the current Cumulative PTF Package (SF99540).

Or you could write a a little something and using an IBM API the CLP code is very simple

IBMi (iSeries AS400) operating system version
 DCL VAR(&VERSION) TYPE(CHAR) LEN(6) DCL VAR(&RCVR) TYPE(CHAR) LEN(128)
 DCL VAR(&RCVRLEN) TYPE(CHAR) LEN(4) VALUE(X'00000080')
 DCL VAR(&FORMAT) TYPE(CHAR) LEN(8) VALUE('PRDR0100')
 DCL VAR(&PRDINFO) TYPE(CHAR) LEN(27) + VALUE('OPSYS CUR 0000CODE ')
 DCL VAR(&APIERROR) TYPE(*CHAR) LEN(4) VALUE(X'00000000')

 CALL PGM(QSZRTVPR) PARM(&RCVR &RCVRLEN &FORMAT +
&PRDINFO &APIERROR)

 CHGVAR VAR(&VERSION) VALUE(%SST(&RCVR 20 6))

 SNDPGMMSG MSG('IBMi Version is' *bcat &RELEASE)

For example, on my little AS400e iSeries 270 eServer System i Power System running IBMi5.4 this will return a status message saying: ยป IBMi Version is V5R4M0

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>

Snug CBD

 20% Discount

I have partnered with SNUG CBD givING you Organic CBD
20% discount code "NL20"