IBM Support

Example of Using dlpar_get_info API to Get the Numerical Partition ID of a Logical Partition (LPAR)

Troubleshooting


Problem

This document has an example of using the dlpar_get_info API to get the numerical partition ID and partition name of a logical partition (LPAR).

Resolving The Problem

The following CL program uses functionality that exists only at R530 or later.
Retrieve Partition Information (dlpar_get_info) API returns information about configuration and CPU utilization of the logical partition where this API was called.
Partition name is the name that has been assigned to this partition. This field is a null-terminated UTF-8 character string.
Hence the CL uses the Convert a Graphic Character String (CDRCVRT, QTQCVRT) API to convert a graphic character data string of the identified string type (ST1) represented in a specified from CCSID (CCSID1) to a graphic character data string of the required string type (ST2) that is represented in another specified to CCSID (CCSID2).

Example CL DLPAR1:
         PGM

         DCL        VAR(&Receiver) TYPE(*CHAR) LEN(367)
         DCL        VAR(&Format) TYPE(*INT) LEN(4) VALUE(X'00000001')
         DCL        VAR(&Length)  TYPE(*CHAR) LEN(4) VALUE(X'0000016F')
         DCL        VAR(&PartnID) TYPE(*CHAR) LEN(3)
         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(1)
         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)

         CALLPRC    PRC('dlpar_get_info') PARM((&Receiver) + (&Format *BYVAL) (&Length *BYVAL))

         CHGVAR     VAR(&PartnID) VALUE(%BIN(&Receiver 41 4))
         CHGVAR     VAR(&CVS1) VALUE(%SST(&Receiver 89 256))
         CALL       PGM(QTQCVRT) PARM((&CVCCSID1) (&CVST1) (&CVS1) (&CVL1) (&CVCCSID2) +
                      (&CVST2) (&CVGCCASN) (&CVL2) (&CVS2) (&CVL3) (&CVL4) (&CVFB))

         SNDPGMMSG  MSG('Partition ID: ' *bcat &PartnID)
         SNDPGMMSG  MSG('Partition Name:' *bcat &CVS2)
         ENDPGM  

Compile using CRTBNDCL.
Call from command line.
> call dlpar1                   
  Partition ID: 014             
  Partition Name:               
    RCHPW740-30420d56-00000a15  

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p000000hB4rAAE","label":"API"},{"code":"a8m3p0000006x8GAAQ","label":"CL"},{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

370499855

Document Information

Modified date:
24 November 2024

UID

nas8N1015657