Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export data to flat files 2

Status
Not open for further replies.

williey

Technical User
Jan 21, 2004
242
I inherited a AS/400 system with an application on it. I had never program in AS/400 environment. How can I export the data in RPG database to flat files?




------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 
If you are not familiar with AS400 then my advice is please at least get training. There should be training modules that can be provided with your company.

To answer your question - start with WRKQRY.
 
There's no RPG database. DB2/400 is the database which is delivered with the machine.

You can FTP the DB2/400 file to any flat file providing that there's no packed or binary data in the file.
 
I programmed on IMS db before. I have no problem handling packed decimals. As matter of fact, we have loaded data dump from IMS using Oracle sql loader.

what I'm trying to achieve is dump all the data out of the application and load it into another database such as Oracle of SQL Server for reporting purposes.

------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 
I don't think you can dump all the data into a database. Maybe what you are trying to tell us is to migrate individual or collective data files into an oracle tables. Here' what I always do whenever we migrate from DB2 to oracle. We are still doing this right now (interfaces). This is to assume that you already knew the data mapping beforehand:
1. Create Physical file that is mapped to your oracle table.
2. Create an RPG, cobol or QRY program to write to the physical file. You will need to convert EBCDIC characters into ASCII files. Be aware of oracle date formatting.
3. Use AS400 ftp capabilities to sent your file to where the
location of your oracle database.
If you are using REFLECTION, you can use this tool too or if you know SQR language then this is the best I can think of because SQR can open multi database at one time.

Hope this helps.
 
You're right, I will be loading each file into a table each.
Sql loader is a powerful utility which can load EBCDIC files into Oracle.



------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 
Well, you could also use the CPYTOIMPF command to import the files into an IFS directory of your choice, the conversion EBCDIC -> ASCII occurs during the copy phase.. From there you can ftp the IFS flat files to load Oracle DB. You don't need a program.

Here's an example not tested.

CPYTOIMPF FROMFILE(MYLIB/MYFILE)
TOSTMF('/home/mydirectory/myfile.txt')
STMFCODPAG(*STDASCII)
RCDDLM(*CRLF)
DTAFMT(*FIXED)
STRDLM(*NONE)
_______________________________________________________
FTP Oracle
User Password
PUT /home/mydirectory/myfile.txt ...
QUIT
 
The information provided here has been great! Thank you guys!

------------------------------------------
There are 10 kinds of people in this world. One that understands binary and the other one that does not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top