Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line

Abstract

This document describes and contains a program that can be used to query the current status of every Hardware Management Console (HMC ) or System Manager (SM) connected to your server, straight from the IBM i command line. The program name is DSPSMDTA.

The program uses the new selection value x'0206' of the MATMATR instruction, which basically returns the machine type/model/serial number plus the TCP/IP configuration of every HMC or SM that is connected to the Server.

Written by:
Matias Centeno Lozada
IBM® AS/400®, iSeries™, System i™, and Power Systems™ SW Support Specialist
MTS - IBM Argentina Support Center

Contents


The following program demonstrates how to use the new selection value X'0206' of the MATMATR instruction to retrieve the machine type/model/serial number plus the TCP/IP configuration of every HMC or SM that is connected to the server:

BEGIN: PGM
DCL VAR(&MATMATR) TYPE(*CHAR) LEN(10516)
DCL VAR(&BYTESIN) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR)
DCL VAR(&BYTESOUT) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR 5)
DCL VAR(&ENTRIES) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR 9)
DCL VAR(&SMTYPE) TYPE(*CHAR) LEN(2)
DCL VAR(&SMINFLEN) TYPE(*CHAR) LEN(2)
DCL VAR(&SMDTALEN) TYPE(*CHAR) LEN(2)
DCL VAR(&SMDTAUTF8) TYPE(*CHAR) LEN(1034)
DCL VAR(&SMDTAASCII) TYPE(*CHAR) LEN(1034)
DCL VAR(&SMT) TYPE(*CHAR) LEN(6)
DCL VAR(&SMSTATUS) TYPE(*CHAR) LEN(10400)
/* */
DCL VAR(&RCVR) TYPE(*CHAR) LEN(22)
DCL VAR(&RCVRLEN) TYPE(*CHAR) LEN(4) +
VALUE(X'00000016')
DCL VAR(&FORMAT) TYPE(*CHAR) LEN(8) +
VALUE('PRDR0700')
DCL VAR(&PRDINFO) TYPE(*CHAR) LEN(27) +
VALUE('*OPSYS *CUR 0000*CODE ')
DCL VAR(&EC) TYPE(*CHAR) LEN(8) +
VALUE(X'0000000000000000')
/* */
DCL VAR(&COUNT) TYPE(*DEC) LEN(4)
DCL VAR(&START) TYPE(*DEC) LEN(4)
DCL VAR(&END) TYPE(*DEC) LEN(4)
DCL VAR(&SIZE) TYPE(*CHAR) LEN(4)
DCL VAR(&ERROR) TYPE(*LGL) VALUE('0')
/* */
DCL VAR(&TYPE) TYPE(*CHAR) LEN(1)
DCL VAR(&CCSID1) TYPE(*INT) LEN(4) VALUE(1208)
DCL VAR(&ST1) TYPE(*INT) LEN(4) VALUE(1)
DCL VAR(&L1) TYPE(*INT) LEN(4) VALUE(1034)
DCL VAR(&CCSID2) TYPE(*INT) LEN(4)
DCL VAR(&ST2) TYPE(*INT) LEN(4) VALUE(2)
DCL VAR(&GCCASN) TYPE(*INT) LEN(4) VALUE(0)
DCL VAR(&L2) TYPE(*INT) LEN(4) VALUE(1034)
DCL VAR(&L3) TYPE(*INT) LEN(4) VALUE(0)
DCL VAR(&L4) TYPE(*INT) LEN(4) VALUE(0)
DCL VAR(&FB) TYPE(*CHAR) LEN(12)
DCL VAR(&CCSID) TYPE(*DEC) LEN(5 0)
DCL VAR(&DFTCCSID) TYPE(*DEC) LEN(5 0)
/* */
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) VALUE('CPF9898')
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) VALUE('QCPFMSG')
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) +
VALUE('*LIBL')
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(512)
DCL VAR(&MSGTYPE) TYPE(*CHAR) LEN(10) +
VALUE('*COMP')
/* */
MONMSG MSGID(CPC0000 CPD0000 CPF0000 MCH0000) +
EXEC(GOTO CMDLBL(ERROR))
/* */
CALL PGM(QSYS/QSZRTVPR) PARM(&RCVR &RCVRLEN +
&FORMAT &PRDINFO &EC)
IF COND(%SST(&RCVR 17 6) < 'V6R1M0') THEN(DO)
CHGVAR VAR(&MSGDTA) VALUE('This tool requires IBM i +
V6R1 at minimum')
GOTO CMDLBL(END)
ENDDO
/* */
CHGVAR VAR(%BIN(&BYTESIN)) VALUE(10516)
CALLPRC PRC('_MATMATR1') PARM((&MATMATR *BYREF) +
(X'0206' *BYREF))
/* */
IF COND(%BIN(&ENTRIES) > 0) THEN(DO)
CHGVAR VAR(&START) VALUE(17)
CHGVAR VAR(&COUNT) VALUE(&COUNT + 1)
CHGVAR VAR(%BIN(&SIZE)) VALUE(%BIN(&ENTRIES) * 6)
GETSMDTA:
CHGVAR VAR(&SMTYPE) VALUE(%SST(&MATMATR &START 2))
CHGVAR VAR(&START) VALUE(&START + 2)
CHGVAR VAR(&SMINFLEN) VALUE(%SST(&MATMATR &START 2))
CHGVAR VAR(&START) VALUE(&START + 2)
CHGVAR VAR(&SMDTALEN) VALUE(%SST(&MATMATR &START 2))
CHGVAR VAR(&L1) VALUE(%BIN(&SMDTALEN))
CHGVAR VAR(%BIN(&SIZE)) VALUE(%BIN(&SIZE) + +
%BIN(&SMDTALEN))
CHGVAR VAR(&START) VALUE(&START + 12)
CHGVAR VAR(&END) VALUE(&START + %BIN(&SMDTALEN))
CHGVAR VAR(&SMDTAUTF8) VALUE(%SST(&MATMATR &START +
&END))
RTVJOBA TYPE(&TYPE) CCSID(&CCSID) DFTCCSID(&DFTCCSID)
IF COND(&CCSID *EQ 65535) THEN(CHGVAR +
VAR(&CCSID2) VALUE(&DFTCCSID))
ELSE CMD(CHGVAR VAR(&CCSID2) VALUE(&CCSID))
CALL PGM(QTQCVRT) PARM(&CCSID1 &ST1 &SMDTAUTF8 +
&L1 &CCSID2 &ST2 &GCCASN &L2 &SMDTAASCII +
&L3 &L4 &FB)
SELECT
WHEN COND(%BIN(&SMTYPE) = 1) THEN(CHGVAR +
VAR(&SMT) VALUE('{HMC}:'))
WHEN COND(%BIN(&SMTYPE) = 2) THEN(CHGVAR +
VAR(&SMT) VALUE('{IVM}:'))
WHEN COND(%BIN(&SMTYPE) = 3) THEN(CHGVAR +
VAR(&SMT) VALUE('{VPM}:'))
OTHERWISE CMD(CHGVAR VAR(&SMT) VALUE('{N/A}:'))
ENDSELECT
CHGVAR VAR(&SMSTATUS) VALUE(&SMSTATUS |< &SMT |< +
&SMDTAASCII)
IF COND(&COUNT = %BIN(&ENTRIES)) THEN(DO)
CHGVAR VAR(&ENTRIES) VALUE(%BIN(&ENTRIES))
CHGVAR VAR(&MSGDTA) VALUE('System Managers +
(HMC/SDMC, IVM, VPM): ' || &ENTRIES)
GOTO CMDLBL(END)
ENDDO
CHGVAR VAR(&START) VALUE(&START + %BIN(&SMINFLEN) - +
16)
CHGVAR VAR(&COUNT) VALUE(&COUNT + 1)
GOTO CMDLBL(GETSMDTA)
ENDDO
CHGVAR VAR(%BIN(&SIZE)) VALUE(29)
CHGVAR VAR(&SMSTATUS) VALUE('This is a non-managed +
Server.')
CHGVAR VAR(&ENTRIES) VALUE(%BIN(&ENTRIES))
CHGVAR VAR(&MSGDTA) VALUE('This is a non-managed +
Server')
GOTO CMDLBL(END)
/* */
ERROR: RCVMSG MSGTYPE(*EXCP) RMV(*YES) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFLIB)
CHGVAR VAR(&MSGTYPE) VALUE('*ESCAPE')
CHGVAR VAR(&ERROR) VALUE('1')
/* */
END: IF COND(&TYPE = '1' & &ERROR ¬= '1') THEN(CALL +
PGM(QUILNGTX) PARM(&SMSTATUS &SIZE +
'CPF9898' 'QCPFMSG *LIBL ' +
X'0000000000000000'))
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(&MSGTYPE)
ENDPGM


Putting it to work

Follow these instructions from an IBM® i command line:

STRSEU SRCFILE(QGPL/QCLSRC) SRCMBR(DSPSMDTA) TYPE(CLLE) OPTION(2) TEXT('Display System Manager Data')

Paste the CLP code example for program STRWSEM and save the member:

CRTBNDCL PGM(QGPL/DSPSMDTA) SRCFILE(QGPL/QCLSRC) OUTPUT(*NONE) USRPRF(*OWNER) LOG(*NO) ALWRTVSRC(*NO) REPLACE(*YES)


How it works

The program DSPSMDTA uses the ILE builtin _MATMATR1 (MATMATR MI instruction) to retrieve the TCP/IP configuration of the machine type/model/serial number plus the TCP/IP configuration of every HMC or SM that is connected to the server where the program is run. It lets you know the current network configuration of every System Manager that is currently acknowledged by your server.
The System Manager data is returned as a string containing a set of keywords with information about the SM. The System Manager data that is returned is the same for all partitions of a physical machine. The type of System Manager is included at the beginning of the string:
  • HMC: Hardware Management Console or Systems Director Management Console
  • IVM: Integrated Virtualization Manager
  • VPM: Virtual Partition Manager
  • N/A: Not available

For example, a System Manager data string can look like this:

{HMC}:HmcStat=1;HscName=7310C05*10A8C9A;HscHostName=w1212b;HscIPAddr
=8.8.181.60; HscAddIPs=;HMCAddIPv6s=fe60:0:0:0:212:5eef:fe93:3e62;

System Manager data keywords are:
  • HscName: System manager name
  • HscIPAddr: IP address of system manager's LAN connection to the partition
  • HscHostName: System manager host name
  • HscAddIPs: Additional IP addresses
  • HmcStat: System manager connection state
  • HMCAddIPv6s: Additional V6 IP addresses

The values of system manager connection state can be:
  • 1: The system manager is connected.
  • 2: The system manager is temporarily disconnected.
  • 3: The system manager is temporarily disconnected.
  • 4: The system manager is not communicating.

Figure 1 shows an example of what you get after the program completes.

MAIN IBM i Main Menu
System: XXXXXXXX
Select one of the following:

..............................................................................
: . :
: {HMC}:HmcStat=1;HscName=7042CR5*100127C;HscHostName=hmc770;HscIPAddr :
: =9.5.30.62;HscAddIPs=172.16.0.1;HMCAddIPv6s=;{HMC}:HmcStat=4;HscName :
: =V107-f6a*0f4c5cb;HscHostName=ivm2sdmc;HscIPAddr=9.5.30.81;HscAddIPs :
: =;HMCAddIPv6s=; :
: :
: :
: Bottom :
: F12=Cancel :
: :
:............................................................................:
90. Sign off

Selection or command
===> call qgpl/dspsmdta________________________________________________________
_______________________________________________________________________________
F3=Exit F4=Prompt F9=Retrieve F12=Cancel F13=Information Assistant
F23=Set initial menu
Figure 1. Example of what you will see when program completes.

After you press the Enter the following completion message displays:

System Managers (HMC/SDMC, IVM, VPM): 0002.

For further information about MATMATR MI instructions and the Machine Interace in general, see the IBM i 7.1 Information Center at the following web pages:

Special Notices

This material has not been submitted to any formal IBM test and is published AS IS. It has not been the subject of rigorous review. IBM assumes no responsibility for its accuracy or completeness. The use of this information or the implementation of any of these techniques is a client responsibility and depends upon the client's ability to evaluate and integrate them into the client's operational environment.

Contact an IBM Sales Specialist


Profile

Publish Date
06 October 2011


Rating:
(based on 1 review)


Author(s)

IBM Form Number
TIPS0840