Download PDF (0.1 MB)

advertisement
򔻐򗗠򙳰
®
Retrieve the Network Configuration of the System
Manager Attached to Your Server From an IBM i
Command Line
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
DCL
DCL
DCL
DCL
DCL
DCL
DCL
DCL
DCL
DCL
VAR(&MATMATR) TYPE(*CHAR) LEN(10516)
VAR(&BYTESIN) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR)
VAR(&BYTESOUT) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR 5)
VAR(&ENTRIES) TYPE(*CHAR) STG(*DEFINED) +
LEN(4) DEFVAR(&MATMATR 9)
VAR(&SMTYPE) TYPE(*CHAR) LEN(2)
VAR(&SMINFLEN) TYPE(*CHAR) LEN(2)
VAR(&SMDTALEN) TYPE(*CHAR) LEN(2)
VAR(&SMDTAUTF8) TYPE(*CHAR) LEN(1034)
VAR(&SMDTAASCII) TYPE(*CHAR) LEN(1034)
VAR(&SMT) TYPE(*CHAR) LEN(6)
VAR(&SMSTATUS) TYPE(*CHAR) LEN(10400)
/* */
DCL
DCL
DCL
DCL
DCL
VAR(&RCVR) TYPE(*CHAR) LEN(22)
VAR(&RCVRLEN) TYPE(*CHAR) LEN(4) +
VALUE(X'00000016')
VAR(&FORMAT) TYPE(*CHAR) LEN(8) +
VALUE('PRDR0700')
VAR(&PRDINFO) TYPE(*CHAR) LEN(27) +
VALUE('*OPSYS *CUR 0000*CODE
')
VAR(&EC) TYPE(*CHAR) LEN(8) +
VALUE(X'0000000000000000')
/* */
DCL
DCL
DCL
DCL
DCL
VAR(&COUNT) TYPE(*DEC) LEN(4)
VAR(&START) TYPE(*DEC) LEN(4)
VAR(&END) TYPE(*DEC) LEN(4)
VAR(&SIZE) TYPE(*CHAR) LEN(4)
VAR(&ERROR) TYPE(*LGL) VALUE('0')
DCL
DCL
DCL
DCL
DCL
DCL
DCL
VAR(&TYPE) TYPE(*CHAR) LEN(1)
VAR(&CCSID1) TYPE(*INT) LEN(4) VALUE(1208)
VAR(&ST1) TYPE(*INT) LEN(4) VALUE(1)
VAR(&L1) TYPE(*INT) LEN(4) VALUE(1034)
VAR(&CCSID2) TYPE(*INT) LEN(4)
VAR(&ST2) TYPE(*INT) LEN(4) VALUE(2)
VAR(&GCCASN) TYPE(*INT) LEN(4) VALUE(0)
/* */
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 1
DCL
DCL
DCL
DCL
DCL
DCL
VAR(&L2) TYPE(*INT) LEN(4) VALUE(1034)
VAR(&L3) TYPE(*INT) LEN(4) VALUE(0)
VAR(&L4) TYPE(*INT) LEN(4) VALUE(0)
VAR(&FB) TYPE(*CHAR) LEN(12)
VAR(&CCSID) TYPE(*DEC) LEN(5 0)
VAR(&DFTCCSID) TYPE(*DEC) LEN(5 0)
DCL
DCL
DCL
VAR(&MSGID) TYPE(*CHAR) LEN(7) VALUE('CPF9898')
VAR(&MSGF) TYPE(*CHAR) LEN(10) VALUE('QCPFMSG')
VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) +
VALUE('*LIBL')
VAR(&MSGDTA) TYPE(*CHAR) LEN(512)
VAR(&MSGTYPE) TYPE(*CHAR) LEN(10) +
VALUE('*COMP')
/* */
DCL
DCL
/* */
MONMSG
MSGID(CPC0000 CPD0000 CPF0000 MCH0000) +
EXEC(GOTO CMDLBL(ERROR))
CALL
PGM(QSYS/QSZRTVPR) PARM(&RCVR &RCVRLEN +
&FORMAT &PRDINFO &EC)
COND(%SST(&RCVR 17 6) < 'V6R1M0') THEN(DO)
VAR(&MSGDTA) VALUE('This tool requires IBM i +
V6R1 at minimum')
CMDLBL(END)
/* */
IF
CHGVAR
GOTO
ENDDO
/* */
CHGVAR
CALLPRC
VAR(%BIN(&BYTESIN)) VALUE(10516)
PRC('_MATMATR1') PARM((&MATMATR *BYREF) +
(X'0206' *BYREF))
IF
CHGVAR
CHGVAR
CHGVAR
COND(%BIN(&ENTRIES) > 0) THEN(DO)
VAR(&START) VALUE(17)
VAR(&COUNT) VALUE(&COUNT + 1)
VAR(%BIN(&SIZE)) VALUE(%BIN(&ENTRIES) * 6)
CHGVAR
CHGVAR
CHGVAR
CHGVAR
CHGVAR
CHGVAR
CHGVAR
VAR(&SMTYPE) VALUE(%SST(&MATMATR &START 2))
VAR(&START) VALUE(&START + 2)
VAR(&SMINFLEN) VALUE(%SST(&MATMATR &START 2))
VAR(&START) VALUE(&START + 2)
VAR(&SMDTALEN) VALUE(%SST(&MATMATR &START 2))
VAR(&L1) VALUE(%BIN(&SMDTALEN))
VAR(%BIN(&SIZE)) VALUE(%BIN(&SIZE) + +
%BIN(&SMDTALEN))
VAR(&START) VALUE(&START + 12)
VAR(&END) VALUE(&START + %BIN(&SMDTALEN))
VAR(&SMDTAUTF8) VALUE(%SST(&MATMATR &START +
&END))
TYPE(&TYPE) CCSID(&CCSID) DFTCCSID(&DFTCCSID)
COND(&CCSID *EQ 65535) THEN(CHGVAR +
VAR(&CCSID2) VALUE(&DFTCCSID))
CMD(CHGVAR VAR(&CCSID2) VALUE(&CCSID))
PGM(QTQCVRT) PARM(&CCSID1 &ST1 &SMDTAUTF8 +
&L1 &CCSID2 &ST2 &GCCASN &L2 &SMDTAASCII +
&L3 &L4 &FB)
/* */
GETSMDTA:
CHGVAR
CHGVAR
CHGVAR
RTVJOBA
IF
ELSE
CALL
SELECT
WHEN
WHEN
WHEN
COND(%BIN(&SMTYPE) = 1) THEN(CHGVAR +
VAR(&SMT) VALUE('{HMC}:'))
COND(%BIN(&SMTYPE) = 2) THEN(CHGVAR +
VAR(&SMT) VALUE('{IVM}:'))
COND(%BIN(&SMTYPE) = 3) THEN(CHGVAR +
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 2
OTHERWISE
ENDSELECT
CHGVAR
IF
CHGVAR
CHGVAR
GOTO
ENDDO
CHGVAR
CHGVAR
GOTO
ENDDO
CHGVAR
CHGVAR
CHGVAR
CHGVAR
GOTO
/* */
ERROR:
RCVMSG
CHGVAR
CHGVAR
/* */
END:
IF
SNDPGMMSG
VAR(&SMT) VALUE('{VPM}:'))
CMD(CHGVAR VAR(&SMT) VALUE('{N/A}:'))
VAR(&SMSTATUS) VALUE(&SMSTATUS |< &SMT |< +
&SMDTAASCII)
COND(&COUNT = %BIN(&ENTRIES)) THEN(DO)
VAR(&ENTRIES) VALUE(%BIN(&ENTRIES))
VAR(&MSGDTA) VALUE('System Managers +
(HMC/SDMC, IVM, VPM): ' || &ENTRIES)
CMDLBL(END)
VAR(&START) VALUE(&START + %BIN(&SMINFLEN) - +
16)
VAR(&COUNT) VALUE(&COUNT + 1)
CMDLBL(GETSMDTA)
VAR(%BIN(&SIZE)) VALUE(29)
VAR(&SMSTATUS) VALUE('This is a non-managed +
Server.')
VAR(&ENTRIES) VALUE(%BIN(&ENTRIES))
VAR(&MSGDTA) VALUE('This is a non-managed +
Server')
CMDLBL(END)
MSGTYPE(*EXCP) RMV(*YES) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) MSGFLIB(&MSGFLIB)
VAR(&MSGTYPE) VALUE('*ESCAPE')
VAR(&ERROR) VALUE('1')
COND(&TYPE = '1' & &ERROR ¬= '1') THEN(CALL +
PGM(QUILNGTX) PARM(&SMSTATUS &SIZE +
'CPF9898' 'QCPFMSG
*LIBL
' +
X'0000000000000000'))
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
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 3
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:
z
z
z
z
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:
z
z
z
z
z
z
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:
z
z
z
z
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.
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 4
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.
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 5
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:
z
z
z
Materialize Machine Attributes (MATMATR)
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/rzatk/MATMATR.htm
Machine interface programming
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/apiref/MIpgmg.htm
IBM i Machine Interface
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/rzatk/mitoc.htm
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 6
Notices
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult your local
IBM representative for information on the products and services currently available in your area. Any reference to an
IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may
be used. Any functionally equivalent product, program, or service that does not infringe any IBM intellectual property
right may be used instead. However, it is the user's responsibility to evaluate and verify the operation of any non-IBM
product, program, or service. IBM may have patents or pending patent applications covering subject matter described
in this document. The furnishing of this document does not give you any license to these patents. You can send
license inquiries, in writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive, Armonk, NY 10504-1785 U.S.A.
The following paragraph does not apply to the United Kingdom or any other country where such provisions
are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain
transactions, therefore, this statement may not apply to you. This information could include technical inaccuracies or
typographical errors. Changes are periodically made to the information herein; these changes will be incorporated in
new editions of the publication. IBM may make improvements and/or changes in the product(s) and/or the program(s)
described in this publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in any manner
serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this
IBM product and use of those Web sites is at your own risk.IBM may use or distribute any of the information you
supply in any way it believes appropriate without incurring any obligation to you. Information concerning non-IBM
products was obtained from the suppliers of those products, their published announcements or other publicly
available sources. IBM has not tested those products and cannot confirm the accuracy of performance, compatibility
or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be
addressed to the suppliers of those products. This information contains examples of data and reports used in daily
business operations. To illustrate them as completely as possible, the examples include the names of individuals,
companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses
used by an actual business enterprise is entirely coincidental.
Any performance data contained herein was determined in a controlled environment. Therefore, the results obtained
in other operating environments may vary significantly. Some measurements may have been made on
development-level systems and there is no guarantee that these measurements will be the same on generally
available systems. Furthermore, some measurement may have been estimated through extrapolation. Actual results
may vary. Users of this document should verify the applicable data for their specific environment.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming techniques
on various operating platforms. You may copy, modify, and distribute these sample programs in any form without
payment to IBM, for the purposes of developing, using, marketing or distributing application programs conforming to
the application programming interface for the operating platform for which the sample programs are written. These
examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability,
serviceability, or function of these programs.
© Copyright International Business Machines Corporation 2011. All rights reserved.
Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by
GSA ADP Schedule Contract with IBM Corp.
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 7
This document was created or updated on October 6, 2011.
Send us your comments in one of the following ways:
Use the online Contact us review form found at:
ibm.com/redbooks
z
Send your comments in an e-mail to:
redbook@us.ibm.com
z
Mail your comments to:
IBM Corporation, International Technical Support Organization
Dept. HYTD Mail Station P099
2455 South Road
Poughkeepsie, NY 12601-5400 U.S.A.
z
This document is available online at http://www.ibm.com/redbooks/abstracts/tips0840.html .
Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business
Machines Corporation in the United States, other countries, or both. These and other IBM trademarked
terms are marked on their first occurrence in this information with the appropriate symbol (® or ™),
indicating US registered or common law trademarks owned by IBM at the time this information was
published. Such trademarks may also be registered or common law trademarks in other countries. A
current list of IBM trademarks is available on the Web at
The following terms are trademarks of the International Business Machines Corporation in the United
States, other countries, or both:
AS/400®
IBM®
iSeries™
Power Systems™
Redbooks (logo)®
System i™
The following terms are trademarks of other companies:
Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel Xeon, Intel
SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
Other company, product, or service names may be trademarks or service marks of others.
Retrieve the Network Configuration of the System Manager Attached to Your Server From an IBM i Command Line 8
Download