/* sample routine to detect the current OS/2 Version without using */ /* REXXUTIL */ curVersion = GetOS2Version() if curVersion = "" then say "Cannot detect the current OS/2 version!" else say "The current OS/2 version is " || curVersion exit 0 /* ------------------------------------------------------------------ */ /* function: Get the current OS/2 version */ /* */ /* call: GetOS2Version */ /* */ /* where: - */ /* */ /* returns: OS/2 Version as string (e.g. "V211") */ /* or an empty string in case of an error */ /* */ /* note: works with CMD.EXE and 4OS2.EXE */ /* */ GetOS2Version: PROCEDURE thisRC = "" /* install a local error handler */ SIGNAL ON ERROR Name GetOS2VersionEnd "@ver | rxqueue " /* read the lines from the QUEUE */ do while queued() <> 0 queueLine = lineIn( "QUEUE:" ) IF QueueLine <> "" THEN DO IF WORD( QueueLine,1 ) = "Version" THEN OS2Ver = WORD( QueueLine,2 ) /* this is cmd running! */ ELSE if word( queueLine,4 ) = "Version" THEN OS2Ver = WORD( queueLine,6 ) /* this is 4OS2 running! */ END /* if ... then do */ end /* do while ... */ /* version string not found: invalid call */ if OS2Ver <> "" then do /* create the string to return */ parse VALUE os2ver WITH mainVer "." minVer if minVer = "30" & mainVer = "2" then thisRC = "V300" else thisRC = "V" || mainVer || minVer end /* if OS2Ver <> "" then */ GetOS2VersionEnd: do while queued() <> 0 dummyLine = lineIN( "QUEUE:" ) end /* do while */ RETURN thisRC