home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxvim.zip / DEMO.CMD < prev    next >
OS/2 REXX Batch file  |  1994-07-19  |  4KB  |  131 lines

  1. /** Demo.cmd **/
  2. /******************************************/
  3. /*                                        */
  4. /* Command line syntax:                   */
  5. /*                                        */
  6. /* demo db_path user_password user_name   */
  7. /*                                        */
  8. /*                                        */
  9. /******************************************/
  10. ARG db_path user_pw user_name
  11. '@echo off'
  12. '@cls'
  13. Say 'RexxVIM General Demonstration Program'
  14. Say
  15.  
  16. /* Unload functions upon error */
  17. SIGNAL ON ERROR NAME done
  18.  
  19. /* Prompt for the parameters if not passed on the */
  20. /* command line                                   */
  21. if LENGTH(STRIP(db_path)) = 0 then do
  22.    Say 'Enter Postoffice Directory:'
  23.    PARSE PULL db_path .
  24.    Say
  25.    Say 'Enter User Name:'
  26.    PARSE PULL user_name
  27.    Say 'Enter Password:'
  28.    PARSE PULL user_pw
  29. end  /* Do */
  30.  
  31.  
  32. /* Load the RexxVIM extensions to Rexx */
  33. rc = RxFuncAdd('RxVIMLoadFuncs', 'REXXVIM', 'RxVIMLoadFuncs')
  34. if rc <> 0 then do
  35.    Say
  36.    Say 'RexxVIM failed to load, return code' rc
  37.    Say
  38.    Say 'Functions have been released.  Retry program.'
  39.    signal done
  40. end  /* Do */
  41. call RxVIMLoadFuncs
  42. Say 'Functions are now loaded'
  43. Say
  44.  
  45.  
  46. /* Initialize the VIM subsystem */
  47. rc = RxVIMInitialize()
  48. Say
  49. Say '|-Call To Routine ---------------RC--|'
  50. Say '  RxVIMInitialize:              ' rc
  51. if (rc > 0) then call vimerr
  52.  
  53.  
  54. /* Retrieve the default session info if present */
  55. rc = RxVIMGetDefaultSessionInfo('def_path', 'def_user')
  56. Say '  RxVIMGetDefaultSessionInfo    ' rc
  57. if (rc > 0) then call vimerr
  58. Say '      Default Path:' def_path
  59. Say '      Default Name:' def_user
  60. Say
  61.  
  62.  
  63. /* Query the maximum subject line length and maximum */
  64. /* text length                                       */
  65. rc = RxVIMQueryCapability('VIMSEL_MAX_SUBJECT_LEN','Query')
  66. Say '  RxVIMQueryCapability          ' rc
  67. if (rc > 0) then call vimerr
  68. Say '      Max Subject Length:' query
  69. rc = RxVIMQueryCapability('VIMSEL_MAX_TEXT_LEN','Query')
  70. if (rc > 0) then call vimerr
  71. Say '         Max Text Length:' query
  72. Say
  73.  
  74.  
  75. /* Open a session with the postoffice using the parameters */
  76. /* provided by the user                                    */
  77. rc = RxVIMOpenSession(db_path,user_name,user_pw,Session)
  78. Say '  RxVIMOpenSession:             ' rc
  79. if (rc > 0) then call vimerr
  80.  
  81.  
  82. /* Retieve the name and type of active session */
  83. rc = RxVIMGetEntityName(Session,'Entity')
  84. Say '  RxVIMGetEntityName            ' rc
  85. if (rc > 0) then call vimerr
  86. Say '      Type:' entity.Type
  87. Say '      Name:' entity.Name
  88. Say
  89.  
  90.  
  91. /* Close the session with the postoffice */
  92. rc = RxVIMCloseSession(Session)
  93. Say '  RxVIMCloseSession:            ' rc
  94. if (rc > 0) then call vimerr
  95.  
  96.  
  97. /* Terminate the active VIM subsystem connection */
  98. rc = RxVIMTerminate()
  99. Say '  RxVIMTerminate:               ' rc
  100. if (rc > 0) then call vimerr
  101. signal done
  102.  
  103.  
  104. /***** VIMErr *******/
  105.  
  106. /* If an error occurs, this function will return the text */
  107. /* associated with the error.  Extended text may be       */
  108. /* displayed if it exists for the specified error.        */
  109.  
  110. VIMERR:
  111.  
  112. rc = RxVIMStatusText(Session,rc,'Status')
  113. Say
  114. Say '|-Error Information -----------------|'
  115. Say '  Error Text:' status.1
  116. Say
  117. Say '  Ext Status:' status.2
  118. rc = RxVIMTerminate()
  119. signal done
  120.  
  121.  
  122. /* The done section will unload the RexxVIM extensions */
  123. /* and exit the program                                */
  124. DONE:
  125. /*** Drop all of the external functions ***/
  126. call RxVIMDropFuncs
  127. Say '|------------------------------------|'
  128. Say 'Demo Complete.  All functions released'
  129. 'pause'
  130. exit
  131.