DDM example 2: Copy a file

After performing the first task in Example 2, you decide you want to copy the current level of the CUSTMAST file (in Philadelphia) to the server in Chicago so you can bring the CUSTMST2 file up to date.

This example assumes that the CUSTMST2 file already exists in Chicago.

The following commands can be used to copy the CUSTMAST file from the Philadelphia server to the CUSTMST2 file on the Chicago server. (These commands are issued on the server in Philadelphia.)

CRTDDMF  FILE(PHILLY/COPYMAST)  RMTFILE(*NONSTD 'CUSTMST2.CHICAGO')
   RMTLOCNAME(CHIC)
CPYF  FROMFILE(PGMLIB/CUSTMAST)  TOFILE(PHILLY/COPYMAST)
   MBROPT(*REPLACE)
Note: One might assume that, as an alternative method, you can create a DDM file on the source server, use the SBMRMTCMD command to submit a Create DDM File (CRTDDMF) command to the target server, and then attempt to use the newly created target DDM file with another SBMRMTCMD command to perform the copy function back to the original server. However, that method will not work, because an iSeries™ server cannot be both a source and target server within the same job.