Friday, October 5, 2007

Save-Restore Commands:

We have a partition for production and one for development. We struggle with copying data and source code between the two machines. FTP copies source members without a problem, but it drops the modification dates on the source records. To copy data files, we can use save files in binary mode, which is a hassle. Also, setting up a scheduled job to refresh certain files on the test system from the production system at night, and while FTP would work; it would be difficult for the job to determine if the transmission succeeded.

A better way to this is to use the SAVRSTxxx commands, especially Save Restore Object (SAVRSTOBJ). Two other commands that we might need occasionally are Save Restore Library (SAVRSTLIB) and Save Restore Objects (SAVRST), for the IFS. There is also Save Restore Configuration (SAVRSTCFG), Save Restore Changed Objects (SAVRSTCHG), and Save Restore Doc/Lib Object (SAVRSTDLO) commands.

The SAVRSTxxx commands go through a process similar to the binary FTP of save files, but without the hassle. Here are some examples.
This command copies data file SOMEFILE from the production system to the DEV system.
SAVRSTOBJ OBJ(SOMEFILE) LIB(MYLIB) RMTLOCNAME(DEV)
OBJTYPE(*FILE)
This command copies an entire source physical file to the test system.
SAVRSTOBJ OBJ(QRPGLESRC) LIB(MYLIB) RMTLOCNAME(DEV)
Here's a command to copy one RPG source member, MYSRCMBR, from production to Development. Notice MBROPT(*NEW) was used here, because the source member did not already exist in QRPGLESRC on the Development system.
SAVRSTOBJ OBJ(QRPGLESRC) LIB(MYLIB) RMTLOCNAME(DEV)
OBJTYPE(*FILE) FILEMBR((QRPGLESRC (MYSRCMBR))) MBROPT(*NEW)

Another nice thing about the SAVRSTxxx commands is that they do not require enrollment in the system distribution directory, as SNDNETF (Send Network File) does.

No comments: