home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / os2ver.zip / os2ver.cmd < prev   
OS/2 REXX Batch file  |  1995-05-02  |  3KB  |  59 lines

  1. /* rexxify                                                        */
  2. /*                                                                */
  3. /* OS2VER.CMD                                                     */
  4. /*                                                                */
  5. /* Test showing how to use os2check in a REXX script to determine */
  6. /* the version of the operating system currently in use.          */
  7. /*                                                                */
  8. /* OS2CHECK.EXE can be used to test whether a program compiled    */
  9. /* specifically for Warp can be run prior to running it.  This    */
  10. /* enables a more friendly message to appear describing that a    */
  11. /* product may require OS/2 Warp in lieu of the SYS Error Box     */
  12. /* that may scare the operator.  A REXX script can use OS2CHECK   */
  13. /* to determine which version of a program to load (e.g., 2.11    */
  14. /* or Warp specific).                                             */
  15. /*                                                                */
  16. /* The parameters permit any level of the operating system to be  */
  17. /* tested.  If no parameters are passed, then 20 30 is used as    */
  18. /* this is the way Warp is identified.                            */
  19. /*                                                                */
  20. /* A return value from os2check will be 0 if what is installed    */
  21. /* matches the values passed.  Otherwise, the major and minor     */
  22. /* values are concatenated into a single value (e.g., 2030 for    */
  23. /* Warp, or 2011 for OS/2 2.11).  A value of (-1) is returned     */
  24. /* if an error is encountered in the parameters passed.           */
  25. /*                                                                */
  26. /* The VERBOSE flag causes a listing of the system information    */
  27. /* to be printed to stderr and can be redirected to a file using  */
  28. /* the 2> redirection facility of OS/2.                           */
  29. /*                                                                */
  30. /* To see how this script may be used, type the following:        */
  31. /* testos2 20 30 1                                                */
  32. /*         |  |  |                                                */
  33. /*  major--+  |  +-- verbose listing                              */
  34. /*     minor--+                                                   */  
  35. /*                                                                */
  36.  
  37. parse upper arg major minor verbose
  38. if major = ''  then major = 20
  39. if minor = '' then minor = 30
  40. '@'os2check major minor verbose
  41. say
  42. if (RC == 0) then
  43. do
  44.    if ((major == 20) & (minor >= 30)) | (major > 20) then
  45.    do
  46.       say "This system is running OS/2 Warp (or higher)."
  47.    end
  48.    else
  49.    do
  50.       say "This is the expected version of OS/2."
  51.    end
  52. end
  53. else
  54. do
  55.    say "This version of OS/2 is "RC
  56. end
  57. exit
  58.  
  59.