Copy spooled and nonspooled DBCS files

You can copy both spooled and nonspooled DBCS files.

Copy spooled files

Copy spooled files that have double-byte data by using the Copy Spooled File (CPYSPLF) command. However, the database file to which the file is being copied must have been created with the IGCDTA(*YES) value specified.

When copying spooled files to a database file that contains double-byte data, an extra column is reserved for the shift-out character. This shift-out character is placed between the control information for the record and the user data. The following table shows the shift-out character column number, based on the value specified for the Control character (CTLCHAR) keyword:

CTLCHAR value Column for shift-out character
*NONE 1
*FCFC 2
*PRTCTL 5
*S36FMT 10

Copy nonspooled DBCS files

You can use the Copy File (CPYF) command to copy double-byte data from one file to another.

When you copy data from a double-byte database file to an alphanumeric database file, specify one of the following parameters on the CPYF command:

When you copy DBCS files to alphanumeric files, the system sends you an informational message describing the difference in file types.

Either the FMTOPT(*MAP) or FMTOPT(*NOCHK) option of the copy file function must be specified for copies from a physical or logical file to a physical file when there are fields with the same name in the from-file and to-file, but the data type for fields is as shown in the following table:

From-file field data type To-file field data type
A (character) J (DBCS-only)
O (DBCS-open) J (DBCS-only)
O (DBCS-open) E (DBCS-either)
E (DBCS-either) J (DBCS-only)
J (DBCS-only) G (DBCS-graphic)
O (DBCS-open) G (DBCS-graphic)
E (DBCS-either) G (DBCS-graphic)
G (DBCS-graphic) J (DBCS-only)
G (DBCS-graphic) O (DBCS-open)
G (DBCS-graphic) E (DBCS-either)

When you use FMTOPT(*MAP) on the CPYF command to copy data to a DBCS-only field or DBCS-graphic field, the corresponding field in the from-file must not be:

If you attempt to copy with one of these specified in the from-field, an error message is sent.

When you copy double-byte data from one database file to another with the FMTOPT(*MAP) parameter specified, double-byte data is copied correctly. The system performs correct padding and truncation of double-byte data to ensure data integrity.

When using the CPYF command with FMTOPT(*MAP) to copy a DBCS-open field to a graphic field, a conversion error occurs if the DBCS-open field contains any SBCS data (including blanks).

Related reference
Copy Spooled File (CPYSPLF) command
Copy File (CPYF) command