Flat file in an RPGLE program

pts.
Tags:
RPGLE
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 recipient, 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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • SevaSergey
    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 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following