MOV (Move)

MOV Command syntax diagram

 

Purpose

The Move (MOV) command moves an object from the directory it is in to a different directory. If the TODIR parameter is used, the object is moved to another directory and the object keeps the same name. If the 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 MOV 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 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:

For more information about integrated file system commands, see the Integrated file system topic in the File systems and management category of the Information Center.

 

Restrictions

  1. The user must have object management authority for the object moved, delete and read authority to the directory the object is currently in, and add and read authority to the directory to which the object is being moved. Execute authority is required for all path prefixes.
  2. Some objects are restricted and are not moved. The physical file systems return an error for these objects.
  3. The directory to which the object is being 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).
  4. Only objects that are a byte stream file type move between file systems.
  5. A directory cannot be moved to a subordinate directory.
  6. Database file members cannot be moved.
  7. You cannot move objects in QDLS between auxiliary storage pools (ASPs).
  8. You cannot move libraries in independent ASP QSYS.LIB to basic auxiliary storage pools (ASPs), however you can move libraries in independent ASP QSYS.LIB to the system ASP or other independent ASPs.

 

Required Parameters

OBJ
Specifies the path name of the object or pattern to be moved.

The object path name can be either a simple name or a name that is qualified with the name of the directory in which the object is located. A pattern can be specified in the last part of the path name. An asterisk (*) matches any number of characters and a question mark (?) matches a single character. If the path name is qualified or contains a pattern, it must be enclosed in apostrophes. See path names for more information on specifying path names.

Note: An object name pattern can only be used when the TODIR parameter is used.

 

Optional Parameters

TODIR
Specifies the path name of the directory to which the object is being moved. The moved object uses the name specified on the OBJ parameter.

.: The path object moves to the current directory.

'directory-name': Specify the name of the directory to which the object is being moved. See path names for more information on specifying path names.

TOOBJ
Specifies the path name of the directory the object is being moved to and the new name of the object. See path names for more information on specifying path names.

Note: The TODIR and TOOBJ parameters are mutually exclusive.

FROMCCSID
Specifies the method for obtaining the coded character set identifier (CCSID) for the source of the move operation. This CCSID will be used for data conversion, if requested. This parameter is ignored if the object specified on the OBJ parameter is not a regular file. A regular file is a file that supports the integrated file system I/O operations open, read, and write.

*OBJ: Use the data CCSID of the object being moved.

*PCASCII: Use the data CCSID of the object being moved to compute a CCSID in the Microsoft Windows encoding scheme (x4105). Use this as the CCSID from which the data will be converted when DTAFMT(*TEXT) is specified. This option allows data from PCs to be converted properly, if the data was created using Microsoft Windows.

*JOBCCSID: The coded character set identifier (CCSID) from the default job CCSID is used.

from-CCSID: Specify a CCSID value between 1 and 65533.

TOCCSID
Specifies the data coded character set identifier (CCSID) for the target of the move operation. This parameter is ignored if the object specified on the OBJ parameter is not a regular file (a regular file is a file that supports the integrated file system I/O operations open, read, and write).

*OBJ: Use the data CCSID of the object being moved. If this CCSID cannot be used by the file system that the object is being moved into, the move operation will fail.

*CALC: Use the data CCSID of the object being moved. If this CCSID cannot be used by the file system that the object is being moved into, allow the file system to determine a different CCSID and continue with the move.

*STDASCII: Compute a CCSID in the IBM PC Data encoding scheme (x2100), based on the source file's CCSID. Associate this CCSID with the target of the move operation and, if DTAFMT(*TEXT) is specified, also use this CCSID for the data conversion. If this CCSID cannot be used by the file system that the object is being moved into, the move operation will fail.

*PCASCII: Compute a CCSID in the Microsoft Windows encoding scheme (x4105), based on the source file's CCSID. Associate this CCSID with the target of the move operation and, if DTAFMT(*TEXT) is specified, also use this CCSID for the data conversion. This option allows the resulting data to be used by Microsoft Windows applications. If this CCSID cannot be used by the file system that the object is being moved into, the move operation will fail.

*JOBCCSID: The coded character set identifier (CCSID) from the default job CCSID is used.

to-CCSID: Specify a CCSID value between 1 and 65533. If this CCSID cannot be used by the file system that the object is being moved into, the move operation will fail.

FROMCODPAG
Specifies the method for obtaining the code page for source of the move operation. This code page will be used for data conversion, if requested. This parameter is ignored if the object specified on the OBJ parameter is not a regular file. A regular file is a file that supports the integrated file system I/O operations open, read, and write.

Note: This keyword is replaced by FROMCCSID but the FROMCODPAG keyword can still be used. However, because this keyword may be removed in a future release, whenever possible use the FROMCCSID keyword.

*OBJ: Use the data code page of the object being moved.

*PCASCII: Use the data code page of the object being moved to compute a code page in the Microsoft Windows encoding scheme (x4105). Use this as the code page from which the data will be converted when DTAFMT(*TEXT) is specified. This option allows data from PCs to be converted properly, if the data was created using Microsoft Windows.

code_page: A code page value between 1-32767.

TOCODEPAGE
Specifies the data code page for the target of the move operation. This parameter is ignored if the object specified on the OBJ parameter is not a regular file (a regular file is a file that supports the integrated file system I/O operations open, read, and write).

Note: This keyword is replaced by TOCCSID but the TOCODEPAGE keyword can still be used. However, because this keyword may be removed in a future release, whenever possible use the TOCCSID keyword.

*OBJ: Use the data code page of the object being moved. If this code page cannot be used by the file system that the object is being moved into, the move operation will fail.

*CALC: Use the data code page of the object being moved. If this code page cannot be used by the file system that the object is being moved into, allow the file system to determine a different code page and continue with the move.

*STDASCII: Compute a code page in the IBM PC Data encoding scheme (x2100), based on the source file's code page. Associate this code page with the target of the move operation and, if DTAFMT(*TEXT) is specified, also use this code page for the data conversion. If this code page cannot be used by the file system that the object is being moved into, the move operation will fail.

*PCASCII: Compute a code page in the Microsoft Windows encoding scheme (x4105), based on the source file's code page. Associate this code page with the target of the move operation and, if DTAFMT(*TEXT) is specified, also use this code page for the data conversion. This option allows the resulting data to be used by Microsoft Windows applications. If this code page cannot be used by the file system that the object is being moved into, the move operation will fail.

code_page: A code page value between 1-32767. If this code page cannot be used by the file system that the object is being moved into, the move operation will fail.

DTAFMT
Specifies the format of the data in the file being moved.

*BINARY: The file contains data in binary form (such as an executable file). Do not convert data on the move. However, if the object being moved to has a different code page than the source object, all extended attributes will be converted into the code page of the new object before being set.

*TEXT: The file contains data in textual form. Convert data to the code page of the new object during the move. The data is processed as text during the move.

If you are moving from a database member to a stream file, any line-formatting characters (such as carriage return, tab, and end-of-file) are just converted from one code page to another.

If you are moving from a stream file to a database member, the stream file must contain end-of-line characters or the move will fail. If the stream file does contain end-of-line characters, the following actions are performed during the move to a database file.

  • End-of-line characters are removed.
  • Records are padded with blanks (for a source physical file member) or nulls (for a data physical file member).
  • Tab characters are replaced by the appropriate number of blanks to the next tab position.

Examples for MOV

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) DTAFMT(*TEXT)

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'.

Error messages for MOV

*ESCAPE Messages

CPFA085
Home directory not found for user &1.
CPFA08E
More than one name matches pattern.
CPFA093
Name matching pattern not found.
CPFA0A1
An input or output error occurred.
CPFA0A7
Path name too long.
CPFA0B0
Request not allowed to operate from one file system to another.
CPFA0B2
No objects satisfy request.
CPFA0B8
&1 objects moved. &2 objects failed.
CPFA0C4
Object name not a file.