File Transfer Examples [ HP ARPA File Transfer Protocol User's Guide ] MPE/iX 5.0 Documentation
HP ARPA File Transfer Protocol User's Guide
File Transfer Examples
The following examples show how files are stored and retrieved between an
MPE XL system and a UNIX system using FTP.
Variable Record Files
The first example in Figure 6-1 shows an FTP user on MPE XL transferring
an ASCII file to a UNIX system then retrieving the file with the original
record structure intact.
AFILE is stored with the attributes: REC=-80,1,V,ASCII. AFILE can
contain records of up to 80 characters. The records are of variable
length. The file transfer is performed:
(1)
ftp> ascii
ftp> put afile xxfile
The UNIX file system stores the data in a contiguous stream, separated by
carriage return characters (<cr>).
To retrieve the file as it was originally stored, the MPE XL FTP user can
do the following:
(2)
ftp> ascii
ftp> get xxfile xxfile;rec=-80,1,v,ascii
Figure 6-1. ASCII Transfer
Mixed Mode Transfer.
If you transfer an ASCII type file in binary mode, you may not be able to
retrieve the file in its original form as pictured in Figure 6-2.
An MPE XL ASCII file, AFILE, transferred to the UNIX system using FTP
binary transfer mode results in a file of contiguous data on the UNIX
system. Note that record structure is not maintained in binary
transfers.
(1)
ftp> binary
ftp> put afile yyfile
When the user tries to retrieve the file using file building parameters
(rec=-80,1,v,ascii), the file is retrieved as one record (since the total
amount of data is less than 80 bytes).
(2)
ftp> binary
ftp> get yyfile yyfile;rec=-80,1,v,ascii
Figure 6-2. Mixed Mode Transfer
Fixed Record Files
Transferring files that contain imbedded carriage return-line feed
characters ( <cr><lf>) can be a problem if you try to transfer these
files in ASCII mode. In FTP ASCII transfer mode, the remote system
interprets a carriage return-line feed pair ( <cr><lf>) as a new record.
One method of transferring a fixed file to a remote system then
retrieving it with the data and record structure intact is pictured in
Figure 6-3.
An MPE XL FTP user transfers an ASCII file with fixed length records of
132 bytes long to a UNIX system in FTP binary mode as follows:
(1)
ftp> binary
ftp> put FXFILE uxfile
On the UNIX system, the file is stored as a contiguous stream, including
the spaces.
To retrieve the file and maintain the original record structure, the MPE
XL user must use the GET command with the following build parameters:
(2)
ftp> binary
ftp> get uxfile uxfile;rec=-132,,f,ascii
Figure 6-3. Fixed Record Transfer
MPE/iX 5.0 Documentation