Line terminating characters in integrated file system files

AIX® and i5/OS™ use different line terminating characters in text files (for example, in files and shell scripts).

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

awk '{ gsub( /\r$/, "" ); print $0 }' < oldfile > newfile

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 AIX to the iSeries™. 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 strips the carriage return (CR) when it processes an inbound file in text mode. i5/OS FTP always writes exactly what is presented in the data stream and always retains CRLF for text mode, which causes problems with the i5/OS PASE 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 iSeries and PC editors

You can also experience problems when you edit your files or shell scripts with editors on your iSeries server 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 i5/OS PASE expects.

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

Related information
IBM Virtual Innovation Center for Hardware