Link to home
Start Free TrialLog in
Avatar of avp17
avp17

asked on

AS/400 Carriage Return, Line Feed

I am exporting a file from an AS/400.  But when I export the file I get a Carriage Return and a Line Feed after every line.  How do I just output a Line Feed or just a Carriage Return?  Thanks.
Avatar of ddekreon
ddekreon

Are you trying to FTP the file to a PC server, or what?
 You can use cpytoimpf to create a file on your IFS with better control over exactly how records end. You can specify exactly what you want: *crlf, *lf, *cr, or whatever
Then you ftp from the IFS or simply copy it over, if you have sharing enabled.
Avatar of avp17

ASKER

I am trying to FTP from an AS/400 to a PC server.  I don't know what cpytoimpf is.  Or IFS.  Could you explain how to use it or what it is?  Thanks.
Avatar of Shalom Carmel
avp17,
I do not know how you currently export the file. Did you write a program to do it? Do you use any third party tools?
The data on the AS400 server resides in a database. The CPYTOIMPF command exports a database to a delimited text file, allowing you to send the file to any other system.
The benefit of this command is the versatility of it. If you are not familiar with it - get to know it.
As for the IFS - it is a PC/Unix compatible file system on the AS400.

Run the following command on the AS400 to create a directory for your converted files:
MKDIR '/export'

When you CPYTOIMPF, create the export file in /export.

If you ftp from the AS400 to another machine, use the following FTP commands on the AS400:

namefmt 0
cd /export
put blabla.csv

If you ftp to the AS400 from another machine, use the following FTP commands:

quote site namefmt 0
cd /export
get blabla.csv

Avatar of avp17

ASKER

These commands are what we currently use.  In fact I know that the CR and LF are in the file before we FTP the file.
Well,
In that case, use CPYFRMIMPF with the proper parameters. You can make the export file with either CR, or LF, or both.
Prompt the command for all the options.
Avatar of avp17

ASKER

Ok.  Let me give you a little background.  I'm not an AS/400 programmer.  I am asking this question for a programmer that does not know how to do this.  Could you show an example of how to use CPYFRMIMPF with the proper parameters?  Say with just a CR. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Shalom Carmel
Shalom Carmel
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial