Link to home
Start Free TrialLog in
Avatar of Bob Butcher
Bob ButcherFlag for United States of America

asked on

how to move a save file from one as400 to another

I am configuring another as400 on our network - and soon our programmers will want to move objects in a save file from one system to another. can someone point me in the right direction on how to set this up?
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Butcher

ASKER

thanks - you gave me some options. I appreciate your help.
Avatar of Member_2_276102
Member_2_276102

A savefile may be copied to and from directories in the /root file system with CPYTOSTMF and CPYFRMSTMF. If a couple rules are followed, some automatic handling can be taken advantage of.

For example, if a savefile named MYSAVF exists in library MYLIB, it can be copied into a directory named /somedir/somesubdir with this command:
CPYTOSTMF FROMMBR( '/QSYS.LIB/MYLIB.LIB/MYSAVF.FILE' ) TOSTMF( '/somedir/somesubdir/IFSSAVF.SAVF' ) STMFOPT( *REPLACE )

Open in new window

Copying from an IFS directory back into a savefile could use this command:
CPYFRMSTMF FROMSTMF( '/somedir/somesubdir/IFSSAVF.SAVF' ) TOMBR( '/QSYS.LIB/MYLIB.LIB/MYSAVF.FILE' )   MBROPT( *REPLACE )

Open in new window

Rules to remember:
  1. Use extension .SAVF for the streamfile name. The system knows it's a savefile by that extension.
  2. For the TOMBR() and FROMMBR() parameters, only the .FILE part of the file name is used. The .MBR part of the name should be left off.
If those rules are followed, the system will recognize that a savefile is being copied. Because of that, a savefile *FILE object will be created automatically when the streamfile is copied into a target library. Once a savefile is stored as a streamfile, the original savefile can be deleted. It can be recreated simply by copying it back into a library using a command such as above.

Of course, as with almost any streamfile, it can be moved or copied to any remote storage. The CPYTOSTMF/CPYFRMSTMF commands can copy directly to/from any network storage that is accessible to the user. Source or destination might be through /QNTC or /QFileSvr.400. It's not necessary to copy to/from a local IBM i directory first. The normal authentication rules apply.

I'd advise creating a test savefile and practicing copying in both directions until it all becomes clear. I keep a savefile named simply SAVF in my current library and a streamfile named savf.savf in my /home directory. They're both used often for my own convenience.