0 pts.
 CR/LF
I am loading a flat file in an RPGLE program. The file will be downloaded to a server and converted to .txt and .dbf. The receipient, a benefits provider, states in the file specifications that their must be a carriage return/linefeed at the end of each record. Can you provide some direction on how to do this. Thank you for your time and information.

Software/Hardware used:
ASKED: June 21, 2006  10:45 AM
UPDATED: December 10, 2009  8:26 AM

Answer Wiki:
Create Constant: d linefeed c x'25' Append Linefeed to your data when you write record string = ( data + LineFeed ); ======================================================= What is a "flat file"? Most often, AS/400 programmers might think of it as being a fixed-lengthy physical file with a record format that contains a single field. But sometimes it's just a streamfile. If you're writing to a physical file, just write records in the same way you always do. When you're done, close the file and use CPYTOSTMF to create your .TXT file complete with CR/LF at the end of every line. If you're writing to a streamfile, just concatenate the CR/LF characters to the end of each line you write. Make sure you use the right hex values depending on whether you output EBCDIC or ASCII. Tom
Last Wiki Answer Submitted:  December 10, 2009  8:26 am  by  Jwebb901   0 pts.
All Answer Wiki Contributors:  Jwebb901   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

It depends on how you transfer the file to the server. If that is a PC server you can use FTP to transfer the file and FTP will insert CR/LF in the end of each line (in ASCII mode). The problem with FTP is that it trims each line and removes trailing spaces. If that is a problem and the vendor requires fixed length records you can convert your file from EBCDIC to ASCII in RPG program and attach CR/LF (X’0D0A’ in EBCDIC) in the end of each line. Then you will have to FTP the file in binary (BIN) mode.

You also can use IBM Client Access file transfer. I don’t use it too often but I believe you can specify wheather you want to trim trailing spaces or not.

If you decide to traslate the file into ASCII I can send you a source of a little program that I wrote a while ago.

Hope it helps
Sergey
sevas@usa.net

 0 pts.