home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Product / Product.zip / viper092.zip / GETREC.CMD < prev    next >
OS/2 REXX Batch file  |  1995-09-20  |  2KB  |  68 lines

  1. /*      VIPER Database Engine
  2.         Read a record and move within a database example.
  3.         Copyright (c) - 1995 by Douglas A. Bebber
  4. */
  5.  
  6.  
  7. /* Register the VIPER Database Engine functions... */
  8. rc = RxFuncAdd("SysLoadViperFuncs","Viper", "SysLoadViperFuncs")
  9. call SysLoadViperFuncs
  10.  
  11. /* OPEN THE DATABASE */
  12. status = RxViperOpenDatabase('CUSTOMER')
  13. if status = 0 then
  14. Do
  15.         say 'Failed to open CUSTOMER database!'
  16.         exit
  17. End
  18. else
  19.         say 'Successfully opened CUSTOMER database!'
  20.  
  21.  
  22. /* MOVE TO FIRST RECORD */
  23.  
  24. status = RxViperMoveToFirstRecord('CUSTOMER', 'LNAME')
  25. say 'Moving to first record in the database...'
  26.  
  27.  
  28. /* GET A RECORD AND DISPLAY IT */
  29. status = RxViperGetRecord('CUSTOMER', 'LNAME', Fields.)
  30. if status = 1 then
  31. do
  32.         do index = 1 to Fields.0
  33.                 say Fields.index
  34.         end
  35. end
  36. else
  37. say status
  38.  
  39. say 'PRESS ANY KEY TO MOVE TO NEXT RECORD...'
  40. pull something
  41.  
  42. status = RxViperMoveToNextRecord('CUSTOMER', 'LNAME')
  43. say 'Moving to the next record in the database...'
  44.  
  45.  
  46. /* GET A RECORD AND DISPLAY IT */
  47. status = RxViperGetRecord('CUSTOMER', 'LNAME', Fields.)
  48. if status = 1 then
  49. do
  50.         do index = 1 to Fields.0
  51.                 say Fields.index
  52.         end
  53. end
  54. else
  55. say status
  56.  
  57.  
  58. /* CLOSE DATABASE */
  59. status = RxViperCloseDatabase('CUSTOMER')
  60. if status = 0 then
  61.         say 'Failed to close the CUSTOMER database!'
  62. else
  63.         say 'Successfully closed the CUSTOMER database!'
  64.  
  65.  
  66. call SysDropFuncs
  67.  
  68.