How do I convert a Unix text file from IFS to a DB file on AS400?
1165 pts.
0
Q:
How do I convert a Unix text file from IFS to a DB file on AS400?
I've got a flat text file that I want to convert from AS400 IFS to a Database file. First I want to convert to a flat file just to prove I can.
The File is being Sent via FTP from Unix to AS400/IFS. Files have been sent in both unix txt format and MDOS format.
Both files can be displayed on IFS no problem.

The problem I run into while running the CPYFRMIMPF command is that the data will copy over to a flat file successfully but when I display the file or query the file the data is unreadable.

CPYFRMIMPF FROMSTMF('/dir/Test/test.txt') TOFILE(testlib/test) MBROPT(*REPLACE) STMFLEN(*TOFILE) RCDDLM(*LF) DTAFMT(*DLM) STRDLM(*NONE) RMVBLANK(*NONE)

How do I convert this file at all to a library/File.member? Second how will I convert this file to fill in a formatted file? The flat file is fixed length and I should be able to break it down by character lengths. I know if I could get Unix to output a CSV file then my life would be alot easier, but I need to be confident that this will work at all before I demand a new file design.
ASKED: Nov 21 2008  0:22 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
145 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
You'll find a discussion of this on
http://www.redbooks.ibm.com/redbooks/pdfs/sg244249.pdf
Page 141
Basically you describe the incoming data as fixed format and create a field definition file to map it to fields in you physical file. (page 142)

Is this a fixed lenth flat file that you are sending to the IFS? If so, you may want to use CPYFRMSTMF.
Last Answered: Dec 1 2008  4:20 PM GMT by Xtreme1   145 pts.
Latest Contributors: Philpl1jb   24610 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Gilly400   23625 pts.  |   Nov 24 2008  10:46AM GMT

Hi,

Why don’t you FTP directly to the AS400 (creating or appending to a flat file)?

Regards,

Martin Gilbert.

 

Slack400   1165 pts.  |   Nov 24 2008  6:43PM GMT

I’ve tried FTP directly to a flat file but the data doesn’t translate.
I’ve tried ASCII and BIN.

I know that this method will make things easier down the road. Eventually this company will be looking to Oracle for an ERP solution and it probably won’t be running on an AS400. So any data transmissions going to the AS400 will be designed with the IFS in mind.

 

Philpl1jb   24610 pts.  |   Nov 24 2008  10:26PM GMT

Is it all garbage or just the numeric fields?

Phil

 

Gilly400   23625 pts.  |   Nov 25 2008  12:49PM GMT

Hi,

If you’re getting garbage through, the chances are that you have a different CCSID (coded character set Id) on the source system to the target system. You can convert from one CCSID to another on the CPYFRMIMPF command (press F9 to get to the extra parameters).

Regards,

Martin Gilbert.

 
0