|
This question 'What's the OS version...' was asked in the midrange-l list recently. Here's a ILE/C program to report it, and some other useful info (some of which can now be obtained from system values) I wrote a few years back... /********************************************************/ /* Get RISC 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> /*-- local structure, to enable compile on older OS versions --*/ typedef struct _MACHINE_INFO_T { char spacer1[4]; char spacer2[4]; char spacer3[4]; char Type[4]; char Model[4]; char P_Model[4]; char Group_Id[4]; char spacer4[4]; char Sys_Type_Ext; char Feature_Code[4]; char Serial_No[10]; char spacer5; } _MACHINE_INFO_T; 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; _MACHINE_INFO_T system_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 --*/ memset(&system_info, ' ', sizeof( _MACHINE_INFO_T ));; 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?"); } memcpy( &(system_info), &(this_400_info.Options.Data.VPD.CEC_Info), sizeof( _MACHINE_INFO_T )); sprintf(msg_string, "Model %.4s, Type %.4s-%.4s, PRC Group %.4s, SN# %.10s, OS is at %s.", system_info.Type, system_info.Model, system_info.Feature_Code, system_info.Group_Id, system_info.Serial_No, os400_ver); sndpgmmsg( "CPF9897", msg_string, "*COMP "); return 0; } 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 C/400 Mailing List! | To submit a new message, send your mail to C400-L@midrange.com. | To subscribe to this list send email to C400-L-SUB@midrange.com. | To unsubscribe from this list send email to C400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: bob@cstoneindy.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.