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.