home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
IMPEXP.ZIP
/
QMIMPO.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-06-19
|
4KB
|
110 lines
/* ********************************************************************** */
/* QMIMPO version 1.0 - Import Query Manager objects - 2/19/90 */
/* ********************************************************************** */
/* If the QM object table doesn't exist yet, it will be created and you */
/* will be prompted to enter a new CREATOR id for the imported objects. */
/* If the QM object table already exists, this renaming is skipped. */
/* The following can be done to rename the imported objects anyway: */
/* 1. Export the existing QM objects to a second IXF file. */
/* 2. Drop the QRWSYS.QRWSYS_OBJECT table */
/* 3. Import the new QM objects using QMIMPO.CMD */
/* (QMIMPO will prompt for a new CREATOR) */
/* 4. Import the old QM objects using QMIMPO.CMD */
/* ********************************************************************** */
Trace 'o'
rcx = Rxfuncquery('SQLDBS')
If rcx <> 0 then
rcy = Rxfuncadd('SQLDBS','SQLAR','SQLDBS')
rcx = Rxfuncquery('SQLEXEC')
If rcx <> 0 then
rcy = Rxfuncadd('SQLEXEC','SQLAR','SQLEXEC')
Say "QMIMPO.CMD - version 1.0 - 2/18/90"
sample_rc = 0
call SQLDBS 'START DATABASE MANAGER'
if result<>0 then signal ERROR
if (SQLCA.SQLCODE <> -1026 & SQLCA.SQLCODE <> 0)
then signal ERROR
FLTMOD = 'FORCEIN'
Do forever
Say ""
Say "Please enter the database name to receive the QM objects or"
Say "Press Enter to exit."
Pull db1
if db1="" then leave
else do forever
Say "Enter name of IXF file that contains the exported QM objects or"
Say "Press Enter to select another database."
Pull ixfname
If ixfname = '' then leave
Else do
say "Importing from" ixfname "...."
crea=1
call SQLDBS 'IMPORT TO' db1 'FROM' ixfname 'OF IXF MODIFIED BY :FLTMOD CREATE INTO QRWSYS.QRWSYS_OBJECT MESSAGES QMIMPO.LOG'
if SQLCA.SQLCODE=-3305 Then Do
call SQLDBS 'IMPORT TO' db1 'FROM' ixfname 'OF IXF MODIFIED BY :FLTMOD INSERT INTO QRWSYS.QRWSYS_OBJECT MESSAGES QMIMPO.LOG'
crea=0
end
if SQLCA.SQLCODE=3107 Then Do
say "Import errors are logged in 'QMIMPO.LOG'"
say "Do you want to see them now? Y or N"
Pull ans
If ans='Y' then 'TYPE QMIMPO.LOG'
end
else if SQLCA.SQLCODE <> 0 then signal ERROR
if crea=1 then do
say "**************************************"
say "QRWSYS.QRWSYS_OBJECT has been created."
say "**************************************"
say ""
end
if crea=1 then do
say "If you want to rename the CREATOR id of the QM objects"
say "just imported, enter the new id below. (max 8 characters)"
say "Press Enter without any data to skip the renaming."
do forever
pull newid
if newid='' then signal FINISH
if length(newid) > 8 then do
say "CREATOR must be 8 characters or less."
iterate
end
if words(newid) > 1 then do
say "Spaces are not allowed."
iterate
end
call SQLDBS 'START USING DATABASE' db1
t='QRWSYS.QRWSYS_OBJECT'
stmt1 = "UPDATE" t "SET CREATOR='"newid"'"
call SQLEXEC 'EXECUTE IMMEDIATE :stmt1'
if sqlca.sqlcode <> 0 then signal ERROR
stmt2 = "UPDATE" t "SET QRW_CREATOR='"newid"'"
call SQLEXEC 'EXECUTE IMMEDIATE :stmt2'
if sqlca.sqlcode <> 0 then signal ERROR
call SQLDBS 'STOP USING DATABASE'
leave
end
end
end
end
end
result=0
signal FINISH
ERROR: result = SQLCA.SQLCODE
say "return code:" result
say SQLMSG
exit result
FINISH: say 'QMIMPO finished and result =' result
exit result
rcy = Rxfuncdrop('SQLDBS')
If rcy <> 0 Then
Say "RXfuncdrop SQLDBS rc =" rcy
rcy = Rxfuncdrop('SQLEXEC')
If rcy <> 0 Then
Say "RXfuncdrop SQLEXEC rc =" rcy