This page describes an AS/400 utility that allows for the copying of data from or to a save file. A similar tool can be found in the QUSRTOOLS product. If you still have QUSRTOOLS look for the CPYFRMSAVF and CPYTOSAVF commands. The command described here (ZCPYSAVF) combines the 2 commands into 1 command.
Information on how to process save files was found in Chapter 8 of the ILE C/400 Programmers Guide. There may also be more information in other OS/400 manuals.
This command can be used to either copy data FROM a save file into a physical file or from a physical file TO a save file. This is useful when tranferring AS/400 objects to another AS/400 without having a communications link between the 2 machines. Objects can be saved to a save file, converted to a physical file, copied to shared folders and then transferred to the other machine (via diskette, e-mail, etc.) where the process can be reversed.
Note that this utility can ONLY copy valid save file data into a save file. That is, the physical file being copied into a save file MUST have been created by a similar process. This is because the data placed into the save file is CHECKSUMd by the operating system to verify the contents of the save file.
This utility utimately calls a simple program (ZCPYSAVF) that reads all records in the IN file (can be either the physical or save file) as 528 byte records (VERY important) and writes them to the OUT file as 528 byte records. The IN/OUT files are flipped to point to either the physical or save file using OVRDBF or OVRSAVF commands (depending on the value of the FROMTO parameter).
The utility consists of a command (ZCPYSAVF), a CL command processing program (ZCPYSAVFCL) and the ZCPYSAVF program which was described previously. I have provided a C version and an RPG version of ZCPYSAVF. I have tested and use the C version all the time. The RPG version is very simple and I recreated it from memory. Use whichever you feel more comfortable with. For those of you who are unfamiliar with the RPG builtin logic cycle ... it'll be OK, just relax! If you're REAL lucky I just might do something with Matching Records logic :)
I use this utility to create the ZIP files that contain executable AS/400 objects found on my Web page. The process I follow to create the files is:
For example, in order to create the ZSQL.ZIP file that contains my ZEXECSQL command I performed the following steps: