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

  1. /*      VIPER Database Engine
  2.         Get database structure information 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. /* GET NUMBER OF FIELDS */
  23.  
  24. NFields = RxViperGetNFields('CUSTOMER')
  25. say 'Database has 'NFields' fields.'
  26.  
  27. /* GET FIELD NAMES */
  28. say 'Database Field Names:'
  29. status = RxViperGetFieldNames('CUSTOMER', FieldNames.)
  30. if status = 1 then
  31. do
  32.         do index = 1 to FieldNames.0
  33.                 say FieldNames.index
  34.          end
  35. end
  36.  
  37. /* GET INDEX INFO */
  38.  
  39. status = RxViperGetIndexNames('CUSTOMER', IndexNames.)
  40. if status = 1 then
  41. Do
  42.         say 'Database has 'IndexNames.0' indexes:'
  43.         say ' '
  44.         do index = 1 to IndexNames.0
  45.  
  46.                 say IndexNames.index' defined as:'
  47.                 status = RxViperGetIndexDescription('CUSTOMER', IndexNames.index, Info.)
  48.                 if status = 1 then
  49.                 do
  50.                         do idex = 1 to Info.0
  51.                                  say Info.idex
  52.                         end
  53.                 end
  54.                 say ' '
  55.         end
  56.  
  57.        
  58. End
  59.  
  60.  
  61. /* CLOSE DATABASE */
  62. status = RxViperCloseDatabase('CUSTOMER')
  63. if status = 0 then
  64.         say 'Failed to close the CUSTOMER database!'
  65. else
  66.         say 'Successfully closed the CUSTOMER database!'
  67.  
  68.  
  69. call SysDropFuncs
  70.  
  71.