/* ================================================================== */
/* LPQVS */
/* */
/* This C sample program shows how to use the z/OS IWMQVS function */
/* to query the name and capacity of the physical processor (CEC), */
/* LPAR and VM image. */
/* */
/* The IWMQVS is the C version of the SYSEVENT QVS interface. */
/* Note that IWMQVS is in SYS1.CSSLIB. */
/* */
/* David Stephens */
/* 23-Sep-2010 */
/* Longpela Expertise */
/* www.longpelaexpertise.com.au */
/* */
/* (C) Copyright 2010, 2012 Longpela Expertise */
/* */
/* This program is free software: you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License as */
/* published by the Free Software Foundation, either version 3 of the */
/* License, or (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* General Public License for more details at */
/* http://www.gnu.org/licenses/ */
/* ================================================================== */
/* ================================================================== */
/* Includes and Variables */
/* ================================================================== */
/* --- Includes ---------------------------------------------------- */
#include "//'SYS1.SIEAHDR.H(IWMQVSH)'" /* Structure for IWMQVS */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* --- Variables ---------------------------------------------------- */
int rc;
struct qvs qvsblk; /* Output from iwmqvs function */
char * str1;
/* ================================================================== */
/* Main Program */
/* ================================================================== */
main() {
/* --- Set Things Up ------------------------------------------- */
qvsblk.qvslen = sizeof(qvsblk); /* Set QVS Block Length */
str1= (char *)malloc(256); /* Area for printing strings */
memset(str1,0,255); /* Zero it */
/* --- Call IWMQVS ----------------------------------------------- */
rc = IWMQVS(&qvsblk);
if (rc > 0)
/* --- Bad return code from IWMQVS ---------------------------- */
printf("LPQVS:IWMQVS retcode=%d\n", rc);
else if (!qvsblk.qvscecvalid)
/* --- CEC Information is not valud --------------------------- */
printf("LPQVS:IWMQVS Invalid CEC Information\n");
else {
/* ------------------------------------------------------------ */
/* Output CEC Machine and Model: */
/* 2064-xxx = z Series 900 */
/* 2066-xxx = z Series 800 */
/* 2084-xxx = z Series 990 */
/* 2086-xxx = z Series 890 */
/* 2094-xxx = System z9 EC */
/* 2096-xxx = System z9 BC */
/* 2097-xxx = System z10 EC */
/* 2098-xxx = System z10 BC */
/* 2817-xxx = zEnterprise 196 */
/* 2818-xxx = zEnterprise 114 */
/* ------------------------------------------------------------ */
memcpy(str1,qvsblk.qvscecmachinetype,4);
memcpy(str1+4,"-",1);
memcpy(str1+5,qvsblk.qvscecmodelid,16);
printf("CEC Machine: %s\n", str1);
memset(str1,0,255); /* Clear output buffer */
/* ------------------------------------------------------------ */
/* Output CEC Capacity (MSU): */
/* ------------------------------------------------------------ */
printf("CEC Capacity (MSU): %d\n", qvsblk.qvsceccapacity);
printf(" \n");
/* ------------------------------------------------------------ */
/* Output LPAR Information (if any): */
/* ------------------------------------------------------------ */
if (!qvsblk.qvsimgvalid)
/* ---- Not running under an LPAR image -------------------- */
printf("Not running under an LPAR\n");
else {
/* ---- Print LPAR name ------------------------------------ */
memcpy(str1,qvsblk.qvsimglogicalpartitionname,8);
printf("LPAR Name: %s\n", str1);
memset(str1,0,255); /* Clear output buffer */
/* ---- Print LPAR ID and capacity ------------------------- */
printf("LPAR ID: %d\n", qvsblk.qvsimglogicalpartitionid);
printf("LPAR Capacity (MSU) %d\n",qvsblk.qvsimgcapacity);
}
printf(" \n");
/* ------------------------------------------------------------ */
/* Output VM Image Information (if any): */
/* ------------------------------------------------------------ */
if (!qvsblk.qvsvmvalid)
/* ---- Not running in a VM image -------------------------- */
printf("Not running under VM\n");
else {
/* ---- Print VM image name -------------------------------- */
memcpy(str1,qvsblk.qvsvmname,8);
printf("VM Name: %s\n", str1);
memset(str1,0,255); /* Clear output buffer */
/* ---- Print VM image capacity ---------------------------- */
printf("VM Capacity (MSU) %d\n",qvsblk.qvsvmcapacity);
}
printf("\n");
} /* else */
} /* main */
|