Line feed problems

Tags:
RPG
I am trying to create a file on the IFS and then ftp this to our client. He requires a line feed between certain fields and Cr/LF (x'25') at the end of the record. I do not have a problem with the end of record requirement. I am using codepage 437 on the as400 and tried x'15' to get only a line feed but get gibberish. Please help!

Answer Wiki

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

In a home-grown application I have had work with, we create a file in the IFS directory as an ASCII file. THen open it in EBCDIC mode with textconv option. Then at each line we need to write a CR/LF we write to the file x’0D’ for the CR in EBCDIC and x’25’ for the LF in EBCDIC. The textconv option takes care of getting the ASCII values in the proper format.

this uses the c procedures open(), write(), and close().

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
  • TomLiotta
    If there are difficulties with figuring out ASCII v. EBCDIC character codes, just ignore them. Have the system do it for you. First thing that should always be done is setting the QCCSID system value to a correct CCSID. Do not let it sit at 65535. Use CCSID 37 for normal U.S. English systems for example. The most likely CCSID to choose is the one that is shown as 'Default coded character set identifier' for most interactive jobs on the system when you run the DSPJOB OPTION(*DFNA) command. Assuming CCSID 37 -- Create the streamfile as CCSID 37. Give it an extension that you'll recognize, e.g., [myfile.ebcdic]. Hard to misunderstand that one. Write your text data, adding normal EBCDIC carriage-return and line-feed characters. Do everything as normal. Pay no attention to thoughts of ANSI/ASCII. When the file is finished:
    CPY OBJ( '/home/MyHomeDir/myfile.ebcdic' )
           TOOBJ( myfile.txt )
           TOCCSID( *PCASCII )
           DTAFMT( *TEXT )
    
    You can then delete myfile.ebcdic if you wish. The new myfile.txt has been created in the current directory as CCSID 1252, all prepared for Windows or almost anything else. Characters including end-of-line are nice and neatly converted. Simple basic system configuration allows you to issue commands such as CPY and control the result through its parms. Tell the system what to do with commands. Have the system do your work for you. That's what programmers do, isn't it? Tom
    125,585 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