CL Command Reference - MOVE

CL Command List > MOVE Reference

Description:

The Move Object (MOVE) command moves an object from the directory it is in to a different directory.

If the To directory (TODIR) parameter is used, the object is moved to another directory and the object keeps the same name. If the To object (TOOBJ) parameter is used the object is also renamed.

If the original object is a read-only file (a file that has the PC read-only attribute flag turned on), the move command operates as follows:

1. If the original file can be deleted (that is, the read-only bit can be turned off for the file), the move will succeed, retaining the read-only attribute of the file.

2. If the original file cannot be deleted, (for example, a CD-ROM file), the move operation will fail and a message will be issued indicating that the source is read-only.

When moving a file within a file system, the Last access date/time, the Data change date/time and the Attribute change date/time are preserved in the new file. If the file is moved outside of the original file system to the ¡åroot¡å (/), QOpenSys, QDLS, or UDFS file systems, the Attribute change date/time is changed to the current time. In the case of moving to a database file member (*MBR) in the QSYS.LIB or independent ASP QSYS.LIB file system, the Data change date/time is updated as well.

This command can also be issued using the following alternative command name:
. MOV

Restrictions:

1. The directory to which the object is to be moved must not already contain the name supplied in the TOOBJ parameter (or in the case where TODIR is used, the name supplied in OBJ cannot exist in TODIR).

2. Only objects that are a byte stream file type move between file systems.

3. A directory cannot be moved to a subordinate directory.

4. Database file members cannot be moved.

5. Objects in QDLS can not be moved between auxiliary storage pools (ASPs).

6. Libraries in independent ASP QSYS.LIB can not be moved to basic auxiliary storage pools (ASPs). However libraries in independent ASP QSYS.LIB can be moved to the system ASP or other independent ASPs.

7. The move command does not copy the private authorities for objects when moving from one file system to another file system.

Note: The authority requirements for this command are complex with respect to file systems, object types, requested operations etc.. Therefore, see the iSeries Security Reference, SC41-5302 book for information about the required authorities for this command.


Examples:

The alternative command name for MOVE is MOV. The following examples use the alternative command name, but MOVE can be replaced directly for MOV in all of them.

Example 1: Moving an Object

MOV OBJ(¡¯/CURRENT/DECEMBER-1994-MONTHLY-PAYROLL-FILE¡¯)
TODIR(¡¯/ARCHIVE¡¯)

This command moves a file named DECEMBER-1994-MONTHLY-PAYROLL-FILE from a directory named CURRENT to a directory named ARCHIVE.



Example 2: Moving with Conversion

MOV OBJ(¡¯/DATAFB¡¯) TOOBJ(¡¯/QSYS.LIB/APP1.LIB/DATA.FILE/DATAFB.MBR¡¯)
TOCODEPAGE(*CALC) DTAFMT(*TEXT) TOCCSID(*CALC)

The stream file ¡¯DATAFB¡¯ is to be moved to the database file ¡¯DATAFB.MBR¡¯. By specifying TOCCSID(*CALC), the file system being moved to (the QSYS.LIB file system in this case) will try to create the new member in the same CCSID as ¡¯/DATAFB¡¯. If this fails (in this case, if ¡¯DATA.FILE is not in the same CCSID as ¡¯DATAFB¡¯), the file system will be allowed to choose an appropriate CCSID and complete the move. By specifying DTAFMT(*TEXT), the data in ¡¯DATAFB¡¯ is handled as text and is converted into the CCSID chosen for the new file ¡¯DATAFB.MBR¡¯.