home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / IMPEXP.ZIP / QMEXPO.CMD < prev    next >
OS/2 REXX Batch file  |  1991-06-19  |  2KB  |  70 lines

  1. /* ********************************************************************** */
  2. /* QMEXPO version 1.0 - EXPORT Query Manager objects - 6/19/91            */
  3. /* ********************************************************************** */
  4. /* ********************************************************************** */
  5. Trace 'o'
  6. rcx = Rxfuncquery('SQLDBS')
  7. If rcx <> 0 then
  8.    rcy = Rxfuncadd('SQLDBS','SQLAR','SQLDBS')
  9. rcx = Rxfuncquery('SQLEXEC')
  10. If rcx <> 0 then
  11.    rcy = Rxfuncadd('SQLEXEC','SQLAR','SQLEXEC')
  12. Say "QMEXPO.CMD - version 1.0 - 6/19/91"
  13.  
  14. sample_rc = 0
  15. call SQLDBS 'START DATABASE MANAGER'
  16. if result<>0 then signal ERROR
  17. if (SQLCA.SQLCODE <> -1026 & SQLCA.SQLCODE <> 0)
  18.   then signal ERROR
  19.  
  20. Do forever
  21.   Say ""
  22.   Say "Please enter the database name containing the QM objects or"
  23.   Say "Press Enter to exit."
  24.   Pull db1
  25.   if db1="" then leave
  26.   else do forever
  27.     Say "Enter name of IXF file to export objects to or"
  28.     Say "Press Enter to select another database."
  29.     Pull ixfname
  30.     If ixfname = '' then leave
  31.     Else do
  32.       say "Exporting from" db1 "...."
  33.       stmt = 'select * from QRWSYS.QRWSYS_OBJECT'
  34.       crea=1
  35.       call SQLDBS 'EXPORT :STMT FROM ' DB1 'TO ' IXFNAME 'OF IXF MESSAGES QMEXPO.LOG'
  36.       end
  37.       if SQLCA.SQLCODE=3107 Then Do
  38.         say "Export errors are logged in 'QMEXPO.LOG'
  39.         say "Do you want to see them now? Y or N"
  40.         Pull ans
  41.         If ans='Y' then 'TYPE QMEXPO.LOG'
  42.       end
  43.       else if SQLCA.SQLCODE <> 0 then signal ERROR
  44.       if crea=1 then do
  45.         say "**************************************"
  46.         say "QRWSYS.QRWSYS_OBJECT has been exported."
  47.         say "**************************************"
  48.         say ""
  49.       end
  50.   end
  51. end
  52.  
  53. result=0
  54. signal FINISH
  55.  
  56. ERROR: result = SQLCA.SQLCODE
  57.        say "return code:" result
  58.        say SQLMSG
  59.        exit result
  60.  
  61. FINISH: say 'QMEXPO finished and result =' result
  62.         exit result
  63.  
  64. rcy = Rxfuncdrop('SQLDBS')
  65.    If rcy <> 0 Then
  66.      Say "RXfuncdrop SQLDBS rc =" rcy
  67. rcy = Rxfuncdrop('SQLEXEC')
  68.    If rcy <> 0 Then
  69.      Say "RXfuncdrop SQLEXEC rc =" rcy
  70.