Line-terminating characters in integrated file system files

The AIX® and IBM® i operating systems use different line-terminating characters in text files; for example, in files and shell scripts.

The AIX applications that are the source for your PASE for i programs expect that lines (for example, in files and shell scripts) will end with a line feed (LF). However, PC software and typical IBM i software often ends lines with a carriage return and line feed (CRLF).

CRLF used with FTP

One example of where this difference can cause problems is when you use File Transfer Protocol (FTP) to transfer source files and shell scripts from the AIX operating system to the IBM i operating system. The FTP standard calls for data sent in text mode to use carriage return and line feed (CRLF) at the end of a line. On AIX, the FTP utility removes carriage returns (CRs) when it processes an inbound file in text mode. IBM i FTP always writes exactly what is presented in the data stream and always retains CRLF for text mode, which causes problems with the PASE for i run time and utilities.

Where possible, use binary mode transfer from an AIX operating system to avoid this problem. Text files transferred from personal computers will, in most cases, have CRLF delimiting lines in the file. Transferring the files first to AIX will correct the problem. The following command can be used as a means to remove the CR from files in the current directory:
awk '{ gsub( /\r$/, "" ); print $0 }' < oldfile > newfile

CRLF used with IBM i and PC editors

You can also experience problems when you edit your files or shell scripts with editors on your system or with editors on your workstation (such as Windows Notepad editor). These editors use CRLF as a new line separator, and not the LF that PASE for i expects.

Numerous editors are available (for instance, the ez editor) that do not use CRLF as new line separators.