What is the carriage return character in an AS/400 db?

donde picture donde · May 10, 2010 · Viewed 12.8k times · Source

I have a client running an AS/400. I have to ftp a flat file over to them. They tell me their return charaters are RN. I don't recognize this, could not find anything on it, and their tech guy is Nick Burns so he refuses to give me any dirtection. Is there a standard return code for AS/400?

I should have mentioned that I have a c# .NET 2.0 console application.

Answer

Heath Hunnicutt picture Heath Hunnicutt · May 10, 2010

The AS/400 uses EBCDIC as a character set, rather than either the DOS or Unix ASCII character set. In Unix, text file lines typically end with ASCII '\n' and in DOS lines typically end with ASCII '\r\n'.

When you FTP, if you use the EBCDIC transfer type, rather than bin or ASCII; ftp is supposed to translate these characters for you.

EBCDIC carriage-return is 0x0D, just like ASCII.
EBCDIC line-feed is 0x25, unlike ASCII 0x0A.

AS/400 EBCDIC new-line has 0x15 - NEL (NExt Line").

For more information on end-of-line termination, see this Wikipedia article.