iSeries SAVF tool
Part of working in the iSeries footprint entails exchanging programs and data between machines. Something that has always messed me around is the fact that whilst an iSeries (or AS/400) save file is forward compatible (i.e. something saved on V2R0M0 will, with some caveats, restore on any machine with a greater version), it is not generally possible to restore something saved on a higher version to a previous version machine. I understand that IBM improve their machine overtime, and that a program compiled for a particular version will (may?) be binary incompatible with a prior release; however I am reasonably sure that the structure and format of DB2/400 files hasn't changed since the System 38 in the early eighties. So why can't I restore files? Further, IBM has gone to enourmous lengths to obfusticate any stuff inside of a save file, up to and including writing the save file data to "read ony" memory space. Fortunately, when the save file no longer lives in the QSYS data space, the gloves can come off.
Thus, the attached tool is the result of this frustration: It will "patch" a savf to a different version, allowing objects saved on VxRyMz to be restored on a previous version - notwithstanding what target version was specified in the original save command. Note that this is not foolproof, and certain objects (especially programs) may well not restore on the earlier version specified. But it might work for you. It can also extract data from an file inside of the savf file.
WARNING - This tool alters the content of a save file, and there is no guarantee that the alteration will not break the file. Back it up or copy it before use!
Due credit to Leif Svalgaard without whom this tool would not be possible! I dunno if he is still active, but as at 2014 his web site was still up. He is a really really clever bloke!
Notes on use:
- There are three copies of the tool, one that runs on Linux, one that runs on Windows, and one that runs directly in PASE. They all have the same parameters / interface.
- When executing in PASE it is possible to specify either a savf in the IFS (by passing only one “file” parameter) or an actual QSYS save file by passing two “file” parameters in the form of LIBRARY FILENAME.
- In PASE, the tool CANNOT update a QSYS based savf directly, so it copies the thing to the IFS before patching, and then back to QSYS after patching. This presupposes that you have enough disk space for the copy to happen!
- Off of the iSeries, when a dump of a file object is requested, translation is done on the data from US EBCIDIC (code page 037) to US ASCII. This translation is hardcoded, and no attempt is made to be clever around what locale the source / target machines are actually running. So the data extracted from a savf data file may be “broken” for your combination of locales. Note also that there is a fixed translation of EBCIDIC control characters, and if the file contains binary fields / data, it is possible that the wheels come off. Standard character, zoned decimal, and packed decimal fields should all work OK.
- As it stands, the tool cannot (yet) deal with compressed save files. The next version may get there - I have a plan mapped out, but have not got to implimentation yet.