15 pts.
 Moving File to a Directory in AS/400
I would like to move a physical file on an AS400 to a directory on the same AS400. Is there a command to do this?

Software/Hardware used:
ASKED: January 3, 2008  5:50 PM
UPDATED: March 9, 2010  2:58 PM

Answer Wiki:
There are several ways to move/copy a file from a library to a directory or folder. You may want to start with a look at commands such as CPYTOPCD and CPYTOSTMF. Without knowing what you are actually trying to accomplish though, it's difficult to give you more direction.
Last Wiki Answer Submitted:  January 3, 2008  6:52 pm  by  bvining   6,055 pts.
All Answer Wiki Contributors:  bvining   6,055 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I meant to move the file to a folder

 15 pts.

 

No, you can’t move a file to a folder. You can copy the content to a folder with CPYTOPCD, but a file from a library cannot exist in a folder. The two different file systems are incompatible. They don’t hold the same kinds of objects.

You can’t move; you have to copy.

Tom

 108,055 pts.

 

Actually, you can move an LIBRARY based object to the IFS based object. Use the MOV or MOVE command and reference the LIBRARY based object using IFS nomenclature.

I’ve tried this on a V6R1 OS and it worked .

The command looked like this:
MOV OBJ(‘QSYS.LIBMYLIB.LIBTESTMOV.FILETESTMOV.MBR’)
TODIR(‘.’)
TOOBJ(testmov.file)
TOCCSID(*PCASCII)
DTAFMT(*TEXT)

the TODIR = ‘.’ will be your user profile home directory. You can be specific if you want. You can find your home directory with the DSPUSRPRF command (look at the last page of attributes).

 880 pts.

 

Ooops. some slashes disappeared from my posting:
there should be a single slash before each of the following:

QSYS.LIB
MYLIB.LIB
TESTMOV.FILE
TESTMOV.MBR

Here’s another shot at it:

OBJ(’\QSYS.LIB\MYLIB.LIB\TESTMOV.FILE\TESTMOV.MBR’)

 880 pts.

 

Actually, you can move an LIBRARY based object to the IFS based object.

Yes, you’re right. It only requires a program-described file or a single-data-field source file. Good catch.

Tom

 108,055 pts.

 

Something else I noticed as I played with it a little more yesterday. It doesn’t move the file, it only moves the member within the file, leaving the file short the member you moved.

 880 pts.