We have several applications that rely on the System Serial Number to control what the job does-- there are differences depending on if the job runs in the Live or Test systems, usually.
Of course, in an LPARd system the serial number is the same for all LPARs.
I scrounged most of this program from the web, and tweaked it. You call the program passing an 8 character parm. It uses 'dlpar_get_info' and stuffs the parm with the right-most 7 characters of the serial number concatenated with the partition number. I'm sorry; I don't remember where I scrounged the original code.
You can tweak the program to include the full serial number and pass back a 2-digit partition ID if needed. We were replacing a RTVSYSVAL, so we wanted the value to fit the same 8-character space.
*MODULE:
/* Compile a module from this source, then type the following: */
/* */
/* CRTPGM PGM(LIB/NAME) MODULE(LIB/MODULENAME) BNDSRVPGM(*LIBL/QPMLPMGT) */
/* */
/* > chgobjown rtvsrlptn *pgm qsecofr */
/* > chgpgm rtvsrlptn usrprf(*owner) */
PGM &SRLPTN
DCL VAR(&SRLPTN) TYPE(*CHAR) LEN(8)
DCL VAR(&SRLNBR) TYPE(*CHAR) LEN(8)
DCL VAR(&Return) TYPE(*CHAR) LEN(4)
DCL VAR(&Receiver) TYPE(*CHAR) LEN(344)
DCL VAR(&Format) TYPE(*INT) LEN(4)
DCL VAR(&Length) TYPE(*INT) LEN(4)
DCL VAR(&BIN4NBR) TYPE(*CHAR) LEN(4)
DCL VAR(&PartnID) TYPE(*INT) LEN(4)
DCL VAR(&PartnID) TYPE(*INT) LEN(4)
DCL VAR(&PartnName) TYPE(*CHAR) LEN(256)
DCL VAR(&MSG1) TYPE(*CHAR) LEN(2)
DCL VAR(&MSG2) TYPE(*CHAR) LEN(30)
DCL VAR(&CVCCSID1) TYPE(*INT) LEN(4) VALUE(1208)
DCL VAR(&CVST1) TYPE(*INT) LEN(4) VALUE(1)
DCL VAR(&CVS1) TYPE(*CHAR) LEN(256)
DCL VAR(&CVL1) TYPE(*INT) LEN(4) VALUE(256)
DCL VAR(&CVCCSID2) TYPE(*INT) LEN(4) VALUE(37)
DCL VAR(&CVST2) TYPE(*INT) LEN(4) VALUE(2)
DCL VAR(&CVGCCASN) TYPE(*INT) LEN(4) VALUE(0)
DCL VAR(&CVL2) TYPE(*INT) LEN(4) VALUE(256)
DCL VAR(&CVS2) TYPE(*CHAR) LEN(256)
DCL VAR(&CVL3) TYPE(*INT) LEN(4) VALUE(256)
DCL VAR(&CVL4) TYPE(*INT) LEN(4)
DCL VAR(&CVFB) TYPE(*CHAR) LEN(12)
CHGVAR VAR(&Format) VALUE(1)
CHGVAR VAR(&Length) VALUE(344)
CHGVAR VAR(&Length) VALUE(344)
CALLPRC PRC('dlpar_get_info') PARM((&RECEIVER) +
(&FORMAT *BYVAL) (&LENGTH *BYVAL)) +
RTNVAL(&RETURN)
CHGVAR VAR(&BIN4NBR) VALUE(%SST(&Receiver 41 4))
CHGVAR VAR(&PartnID) VALUE(%BIN(&BIN4NBR))
CHGVAR VAR(&MSG1) VALUE(&PartnID)
CHGVAR VAR(&CVS1) VALUE(%SST(&Receiver 89 256))
CALL PGM(QTQCVRT) PARM(&CVCCSID1 &CVST1 &CVS1 +
&CVL1 &CVCCSID2 &CVST2 &CVGCCASN &CVL2 +
&CVS2 &CVL3 &CVL4 &CVFB)
CHGVAR VAR(&PartnName) VALUE(&CVS2)
CHGVAR VAR(&MSG2) VALUE(&CVS2)
SNDPGMMSG MSG(&MSG1 *BCAT &MSG2)
RTVSYSVAL SYSVAL(QSRLNBR) RTNVAR(&SRLNBR)
RTVSYSVAL SYSVAL(QSRLNBR) RTNVAR(&SRLNBR)
CHGVAR VAR(&SRLPTN) VALUE(%SST(&SRLNBR 2 7) *TCAT +
%SST(&MSG1 2 1))
ENDPGM
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
A Test Program:
PGM
DCL VAR(&SRLNBR) TYPE(*CHAR) LEN(8)
CALL PGM(RTVSRLPTN) PARM(&SRLNBR)
SNDPGMMSG MSG('Serial Number + Partition ID >' *CAT +
&SRLNBR *CAT '<')
ENDPGM
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Paul E Musselman
PaulMmn@xxxxxxxxxxxxxxxxxxxx
.
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: Monday, September 15, 2014 10:19 AM
To: midrange-l@xxxxxxxxxxxx
Subject: API to retrieve lpar (partition) number
Is there some simple API to retrieve the lpar number? I am having an
issue with a software vendor who is having an issue with their key.
Sending them HMC screen shots is getting us nowhere.
They actually tried to get us to go into STRSST, 5. Work with system
partitions, which no one has used since, what, Power 4's?
So I thought using a service program api like
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/apis/dlpar_get_info.htm
would overwhelm them.
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.