home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
IMPEXP.ZIP
/
TBLEXPO.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-08-20
|
3KB
|
88 lines
/* ********************************************************************** */
/* TBLEXPO version 1.0 - EXPORT TABLES - 8/20/91 */
/* */
/* */
/* WHEN SPECIFYING A TABLE NAME YOU MUST ENTER THE FULLY QUALIFIED */
/* TABLE NAME. EG. USERID.MYTABLE */
/* */
/* */
/* WHEN SPECIFYING AN EXPORT FILE NAME YOU MUST INCLUDE THE EXTENSION */
/* 'IXF'. EG. MYTABLE.IXF */
/* */
/* ********************************************************************** */
/* ********************************************************************** */
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 "TBLEXPO.CMD - version 1.0 - 8/20/91"
sample_rc = 0
call SQLDBS 'START DATABASE MANAGER'
if result<>0 then signal ERROR
if (SQLCA.SQLCODE <> -1026 & SQLCA.SQLCODE <> 0)
then signal ERROR
Do forever
Say ""
Say "Please enter the database name containing the tables or"
Say "Press Enter to exit."
Pull db1
if db1="" then leave
else do forever
Say "Enter table name or"
Say "Press Enter to select another database."
Pull tblname
If tblname = '' then leave
Say "Enter fully qualified name of IXF file to export data to "
Say "Press Enter to select another database."
Pull ixfname
If ixfname = '' then leave
Else do
say "Exporting from" tblname " to " ixfname "....."
crea=1
stmt = 'SELECT * FROM ' TBLNAME
call SQLDBS 'EXPORT :STMT FROM ' DB1 ' TO ' IXFNAME ' OF IXF MESSAGES TBLEXPO.LOG'
if SQLCA.SQLCODE=3107 Then Do
say "Import errors are logged in 'TBLEXPO.LOG'"
say "Do you want to see them now? Y or N"
Pull ans
If ans='Y' then 'TYPE TBLEXPO.LOG'
end
else if SQLCA.SQLCODE <> 0 then signal ERROR
if crea=1 then do
say "**************************************"
say "TABLE " TBLNAME " has been exported"
say "**************************************"
say ""
end
end
end
end
result=0
signal FINISH
ERROR: result = SQLCA.SQLCODE
say "return code:" result
say SQLMSG
exit result
FINISH: say 'TBLEXPO 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