/* Determine OS/2 version and fixpack level */ /* Original Rexx script by Mike Ruskai */ /* Adapted to [a] include international versions, */ /* and [b] add return codes by Rob van der Woude */ /* Check for command line parameters */ parse upper arg param dummy if param <> "" then do if dummy <> "" then call Syntax parse value param with dummy"/"option if dummy <> "" then call Syntax if option <> "" then option = left( option, 1 ) select when option = "B" then returncode = "OS2VER" when option = "F" then returncode = "FPLEVEL" when option = "O" then returncode = "OS2VER" otherwise call Syntax end end /* Initialize RexxUtil */ if RxFuncQuery( "SysLoadFuncs" ) <> 0 then do call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs" call SysLoadFuncs end /* Check Rexx version and use the appropriate */ /* method to determine the boot drive */ parse version verstring if word( verstring , 1 ) = "OBJREXX" then do bootdrive = SysBootDrive( ) end else do path = value( "PATH", , "OS2ENVIRONMENT" ) parse upper value path with ":\OS2\SYSTEM" -1 bootdrive +2 if path = "" | bootdrive = "" then do say say "Unable to determine boot drive" exit 9 end end /* Read SYSLEVEL.OS2 and extract version strings */ syslevel = bootdrive||"\OS2\INSTALL\SYSLEVEL.OS2" check = stream( syslevel, "c", "open read" ) if check = "" then do say say "Unable to open SYSLEVEL.OS2" exit 8 end leveldata = charin( syslevel, , chars( syslevel ) ) call stream syslevel, "c", "close" /* Check and format version strings */ parse var leveldata "XR" fplevel "_XR" os2ver "_IBM" fplevel = right( fplevel, 3 ) os2ver = right( os2ver, 4 ) / 1000 if strip( fplevel ) = "" | datatype( fplevel, "W" ) = 0 |, strip( os2ver ) = "" | datatype( os2ver, "W" ) = 0 then do say say "Unable to determine version and fixpack level" exit 7 end /* Read SYSLEVEL.FPK and extract fixpack version */ syslevel = bootdrive||"\OS2\INSTALL\SYSLEVEL.FPK" check = stream( syslevel, "c", "open read" ) if check <> "" then do leveldata = charin( syslevel, , chars( syslevel ) ) parse var leveldata "XR" fplevel "_XR" fplevel = right( fplevel, 3 ) if strip( fplevel ) = "" | datatype( fplevel, "W" ) = 0 then do say say "Unable to determine fixpack level" end end call stream syslevel, "c", "close" /* Format fixpack version string */ fplevel = format( fplevel, , 0 ) /* Display results */ say "OS/2 base version: "||os2ver say "OS/2 fixpack level: "||fplevel /* Quit */ if returncode = "OS2VER" then exit os2ver if returncode = "FPLEVEL" then exit fplevel exit 0 Syntax: say say "RxSysLvl" say "Returns OS/2 Version and FixPack Level" say say "Usage: RXSYSLVL [ /Base_version | /Fixpack_level ]" say say " /B return code = OS/2 Major Version Number" say " /F return code = FixPack Level" say " blank (none) return code = 0" say " any other parameter return code = 255" exit 255 return