Last active
January 31, 2024 15:47
-
-
Save bobcozzi/b2a3dee2fbb89f67fc0acf2cb7bf425e to your computer and use it in GitHub Desktop.
How to obtain the IBM i version at runing in an RPG iV routine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code segment: Retrieve IBM i VRM (Version, Release Modification) | |
// This code shows you how to setup/prototype the CEEGPID API | |
// in RPG IV, and then call it to retrieve the IBM i version. | |
// Note that CEExxxx APIs are high-speed APIs and their code | |
// is embedded or "inlined" into your program. So there | |
// is no overhead for the call to these APIs. | |
// Written June 1996 by R. Cozzi, Jr. | |
// Converted to RPG IV free format August 2018 | |
// This DS template may be used for the FC parameter, | |
// But for the CEEGPID API, *OMIT is good enough. | |
dcl-ds FB_T Qualified Inz TEMPLATE; | |
msgsev uns(5); | |
msgno uns(5); | |
flags char(1); | |
Facility_ID char(3); | |
Info uns(10); | |
end-ds; | |
// This is the prototype for the Get Platform ID API. | |
// This built-in/high-performance API returns the | |
// the current version of IBM i as an interger. | |
// For example V7R3M0 is returned as 730 | |
// V7R5M0 is returned as 750 | |
dcl-pr CEEGPID extproc('CEEGPID'); | |
ver int(10); | |
platform int(10); | |
fc char(12) OPTIONS(*OMIT); | |
end-pr; | |
dcl-s IBMi_Version INT(10); | |
dcl-s platform INT(10); | |
dcl-s FC CHAR(12); | |
// Calling CEEGPID requires all 3 parameters. | |
// Optionally, parameter 3 may be specified as *OMIT | |
// The IBM i Version is returned to parameter 1, | |
// parameter 2 returns an ID indicating the platform | |
// (OS). It is always 4 which means IBM i. | |
CEEGPID( IBMi_Version : platform : fc); | |
// Here we are simply showing how to log | |
// the IBM i version to the joblog. | |
snd-msg 'Current IBM i Version: ' + %char(IBMi_Version); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment