|
Albert, I kept this one around. /***************************************************/ /* Get machine model, type, proc_grp, sn#, OSver */ /* Author - Phil Hall phall@ssax.com */ /***************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <qmhsndpm.h> #include <qszrtvpr.h> #include <mimchint.h> typedef struct error_code_struct { int bytes_provided; int bytes_avail; char expt_id[7]; char RESERVED; char expt_data[100]; } Error_Code_Struct; /*-- Function prototypes --*/ void sndpgmmsg(char *msd_id, char *msg_data, char *msg_type); int main (void) { _MMTR_Template_T this_400_info; Qsz_Product_Info_Rec_t prd_to_query; Qsz_PRDR0100_t prd_info; Error_Code_Struct error_code; char os400_ver[10]; char msg_string[100]; /*-- get system info --*/ this_400_info.Options.Template_Size = sizeof(this_400_info); matmatr( &this_400_info, _MMTR_VPD ); /*-- get OS/400 version --*/ memset(&prd_to_query, ' ', sizeof(prd_to_query)); memset(&error_code, 0, sizeof(error_code)); memcpy(prd_to_query.Product_Id, "*OPSYS", 6); memcpy(prd_to_query.Release_Level, "*CUR", 4); memcpy(prd_to_query.Product_Option, "0000", 4); memcpy(prd_to_query.Load_Id, "*CODE", 5); /*-- let's query the OS/400 product --*/ QSZRTVPR( &prd_info, sizeof(prd_info), "PRDR0100", &prd_to_query, &error_code); if (error_code.bytes_avail == 0) { /*-- we have the product info for OS/400 licpgm--*/ sprintf(os400_ver, "%.6s", prd_info.Release_Level ); } else { /*-- error ocurred --*/ strcpy(os400_ver, "V?R?M?"); } sprintf(msg_string, "Model %.4s, Type %.4s-%.4s, PRC Group %.4s, SN# %.10s, OS is at %s.", this_400_info.Options.Data.VPD.CEC_Info.Type, this_400_info.Options.Data.VPD.CEC_Info.Model, this_400_info.Options.Data.VPD.CEC_Info.Feature_Code, this_400_info.Options.Data.VPD.CEC_Info.Group_Id, this_400_info.Options.Data.VPD.CEC_Info.Serial_No, os400_ver); sndpgmmsg( "CPF9897", msg_string, "*COMP "); return 1; } void sndpgmmsg(char *msg_id, char *msg_data, char *msg_type) { Error_Code_Struct err_code; char msg_key[4]; char tmp_msg_id[7]; char tmp_msg_type[10]; memset(&err_code, 0, sizeof(err_code)); /*-- copy parms to AS/400 API format... --*/ memcpy(tmp_msg_id, msg_id, sizeof(tmp_msg_id)); memcpy(tmp_msg_type, msg_type, sizeof(tmp_msg_type)); /*-- send message... --*/ QMHSNDPM(tmp_msg_id, "QCPFMSG QSYS ", msg_data, strlen(msg_data), tmp_msg_type, "* ", 3, msg_key, &err_code); } +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.