Trilobyte Software Systems

This technical note provides tips for transferring PC files to and from the AS/400 in the SAVE format.

What is the SAVE format?

IP Client defines a special file format for saving and restoring PC files on the AS/400 as physical data files. Using this format, it is possible to upload PC files to the AS/400, and then download them to the another PC without gaining extraneous data (to pad the file to a multiple of AS/400 record length), or losing characteristics of the PC file such as creation date or read-only status. In other words, the PC file uploaded and then downloaded in the SAVE format will exactly match the original PC file in every respect but the user-specified file name.

Uploading and downloading PC files in the SAVE format was designed to be simple, and it is - except for the first time the upload function is used. Unfortunately, the IBM-defined file transfer API used by IP Client requires that an object, namely a "field reference file", must already exist on the AS/400 before a data file may be created. This seems to be a source of much confusion to users attempting for the first time to upload files in the SAVE format.

Creating an AS/400 Field Reference File

Before a PC file can be uploaded to a new AS/400 data file, a "field reference file" must first exist on the AS/400 to define the new file's record layout (the names, types and order of fields in the record). A field reference file is nothing more than an existing AS/400 file that has the same record layout as the new file you are trying to create.

The SAVE format uses a simple record layout: each record consists of a single, 2048 character alphameric field named "PCSAVF". To create a field reference file, first create a source member (using SEU or PDM, or by uploading the file PCSAVDDS.SRC to a source member) with the following two entries defining the record layout:

     A          R SAVREC

     A          PCSAVF    2048A

Use the CRTPF command, referencing the DDS source member created above, to create a field reference file for use with subsequent uploads in the SAVE format.

Uploading files in the SAVE format

To upload a PC file in the SAVE format, enter "*SAVE" in the "PC File Description File name" edit box. If the transfer request will create a new data file on the AS/400, the aforementioned field reference file name must be entered in the "AS/400 field reference file" edit box.

Downloading files in the SAVE format

To download a file previously uploaded in the SAVE format, choose "SAVE" from the "PC file type" drop down list. Besides the PC and AS/400 file names, there is nothing else to enter. The file will be restored on the PC with its data, date and attributes intact.
Note that you can't download a file in the SAVE format unless it was previously uploaded that way.

An easy method for saving & restoring PC files

Instead of creating a field reference file to specify whenever uploading a new PC file to the AS/400, consider creating an AS/400 data file that is capable of containing multiple members. Each PC file uploaded to the AS/400 would then be uploaded as a member in this file rather than occupying a unique AS/400 data file.

Such a file is created identically to creating the field reference file for SAVE format uploading (see above), but the MAXMBRS parameter of the CRTPF command must be changed to *NOMAX (the AS/400 default for MAXMBRS is 1, for some reason).

Having once created the multiple-member AS/400 data file, uploading and downloading PC files in the SAVE format is much simpler, as there is no need to ever specify a field reference file. One only needs to remember to choose "new member" whenever uploading a PC file for the first time.