home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxvim.zip / DEMO.CMD < prev    next >
OS/2 REXX Batch file  |  1994-11-23  |  4KB  |  134 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.    Say '---------------------------------------------'
  40.    rc = RxFuncDrop('RxVIMLoadFuncs')
  41.    signal done
  42. end  /* Do */
  43. call RxVIMLoadFuncs
  44. Say 'Functions are now loaded'
  45. Say
  46. Say RxVIMVersion()
  47.  
  48.  
  49. /* Initialize the VIM subsystem */
  50. rc = RxVIMInitialize()
  51. Say
  52. Say '|-Call To Routine ---------------RC--|'
  53. Say '  RxVIMInitialize:              ' rc
  54. if (rc > 0) then call vimerr
  55.  
  56.  
  57. /* Retrieve the default session info if present */
  58. rc = RxVIMGetDefaultSessionInfo('def_path', 'def_user')
  59. Say '  RxVIMGetDefaultSessionInfo    ' rc
  60. if (rc > 0) then call vimerr
  61. Say '      Default Path:' def_path
  62. Say '      Default Name:' def_user
  63. Say
  64.  
  65.  
  66. /* Query the maximum subject line length and maximum */
  67. /* text length                                       */
  68. rc = RxVIMQueryCapability('VIMSEL_MAX_SUBJECT_LEN','Query')
  69. Say '  RxVIMQueryCapability          ' rc
  70. if (rc > 0) then call vimerr
  71. Say '      Max Subject Length:' query
  72. rc = RxVIMQueryCapability('VIMSEL_MAX_TEXT_LEN','Query')
  73. if (rc > 0) then call vimerr
  74. Say '         Max Text Length:' query
  75. Say
  76.  
  77.  
  78. /* Open a session with the postoffice using the parameters */
  79. /* provided by the user                                    */
  80. rc = RxVIMOpenSession(db_path,user_name,user_pw,Session)
  81. Say '  RxVIMOpenSession:             ' rc
  82. if (rc > 0) then call vimerr
  83.  
  84.  
  85. /* Retieve the name and type of active session */
  86. rc = RxVIMGetEntityName(Session,'Entity')
  87. Say '  RxVIMGetEntityName            ' rc
  88. if (rc > 0) then call vimerr
  89. Say '      Type:' entity.Type
  90. Say '      Name:' entity.Name
  91. Say
  92.  
  93.  
  94. /* Close the session with the postoffice */
  95. rc = RxVIMCloseSession(Session)
  96. Say '  RxVIMCloseSession:            ' rc
  97. if (rc > 0) then call vimerr
  98.  
  99.  
  100. /* Terminate the active VIM subsystem connection */
  101. rc = RxVIMTerminate()
  102. Say '  RxVIMTerminate:               ' rc
  103. if (rc > 0) then call vimerr
  104. signal done
  105.  
  106.  
  107. /***** VIMErr *******/
  108.  
  109. /* If an error occurs, this function will return the text */
  110. /* associated with the error.  Extended text may be       */
  111. /* displayed if it exists for the specified error.        */
  112.  
  113. VIMERR:
  114.  
  115. rc = RxVIMStatusText(Session,rc,'Status')
  116. Say
  117. Say '|-Error Information -----------------|'
  118. Say '  Error Text:' status.1
  119. Say
  120. Say '  Ext Status:' status.2
  121. rc = RxVIMTerminate()
  122. signal done
  123.  
  124.  
  125. /* The done section will unload the RexxVIM extensions */
  126. /* and exit the program                                */
  127. DONE:
  128. /*** Drop all of the external functions ***/
  129. call RxVIMDropFuncs
  130. Say '|------------------------------------|'
  131. Say 'Demo Complete.  All functions released'
  132. 'pause'
  133. exit
  134.