I need to transfer data from an AIX box to the iSeries. I have been able to do this using interactive SQL with DRDA. I want to create code to run this transfer in batch, but can't figure out how to control or specify session attributes to write to an outfile on the local database. Can you help?
Instead of you writing a tool, IBM does have a product called DB2 DataPropagator that uses DRDA to perform the functionality that you describe -- including scheduling of the data transfer.
If you want to write your own tool, then you need to embed SQL in a high-level language program and call that program in batch. As you've experienced, a single SQL statement using DRDA can only reference database objects from one database server at a time. Your tool would have to do steps similar to what interactive SQL does with DRDA. Select & fetch data from the AIX server into data structures (i.e. array) in your OS/400 program and then use those populated structures to perform an SQL Insert statement into your local database. You will want to use blocked fetches & inserts to get the best performance.
Search400.com's targeted search engine: Get relevant information on DB2/400
The Best Web Links: tips, tutorials and more
Check out this online event, Getting the Most out of SQL & DB2 UDB for the iSeries
Dig Deeper on DB2 UDB (universal databases)
Related Q&A from Kent Milligan
To solve the SQL error -321 on IBM i6.1, use the new values statement to overcome the error. If you are using an older release, declare a cursor ... Continue Reading
When working with DB2 files with columns that have both short and long names, there is no option choose which column names are returned via ODBC ... Continue Reading
When developing tables in a parent-child relationship, use a primary key and a foreign key along with a unique ID to make your database easier to ... Continue Reading