Copy nonspooled DBCS files

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

When copying data from a double-byte database file to an alphanumeric database file, specify one of the following parameters on the CPYF command:
  • If both files are source files or if both files are database files, you can specify either the FMTOPT(*MAP) parameter or the FMTOPT(*NOCHK) parameter.
  • If one file is a source file and the other file is a database file, specify the FMT(*CVTSRC) parameter.

When you copy DBCS files to alphanumeric files, the server 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)
G (UCS-2 graphic) A (Character (CCSID non-65535))
G (UCS-2 graphic) O (DBCS-open (CCSID non-65535))
G (UCS-2 graphic) E (DBCS-either (CCSID non-65535))
G (UCS-2 graphic) J (DBCS-only (CCSID non-65535))
G (UCS-2 graphic) G (DBCS-graphic)
A (Character (CCSID non-65535)) G (UCS-2 graphic)
O (DBCS-open (CCSID non-65535)) G (UCS-2 graphic)
E (DBCS-either (CCSID non-65535)) G (UCS-2 graphic)
J (DBCS-only (CCSID non-65535)) G (UCS-2 graphic)
G (DBCS-graphic) G (UCS-2 graphic)
A (UTF-8) A (Character (CCSID non-65535))
A (UTF-8) O (DBCS-open (CCSID non-65535))
A (UTF-8) E (DBCS-either (CCSID non-65535))
A (UTF-8) J (DBCS-only (CCSID non-65535))
A (UTF-8) G (DBCS-graphic non-65535)
A (UTF-8) G (UTF-16)
A (UTF-8) G (UCS-2 graphic)
A (Character (CCSID non-65535)) A (UTF-8)
O (DBCS-open (CCSID non-65535)) A (UTF-8)
E (DBCS-either (CCSID non-65535)) A (UTF-8)
J (DBCS-only (CCSID non-65535)) A (UTF-8)
G (DBCS-graphic non-65535) A (UTF-8)
G (UCS-2 graphic) A (UTF-8)
G (UTF-16) A (Character (CCSID non-65535))
G (UTF-16) O (DBCS-open (CCSID non-65535))
G (UTF-16) E (DBCS-either (CCSID non-65535))
G (UTF-16) J (DBCS-only (CCSID non-65535))
G (UTF-16) G (DBCS-graphic non-65535)
G (UTF-16) A (UTF-8)
G (UTF-16) G (UCS-2 graphic)
A (Character (CCSID non-65535)) G (UTF-16)
O (DBCS-open (CCSID non-65535)) G (UTF-16)
E (DBCS-either (CCSID non-65535)) G (UTF-16)
J (DBCS-only (CCSID non-65535)) G (UTF-16)
G (DBCS-graphic non-65535) G (UTF-16)
G (UCS-2 graphic) G (UTF-16)
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:
  • Less than a 2-byte character field
  • An odd-byte-length character field
  • An odd-byte-length DBCS-open field
Note: DBCS-graphic is the only type allowed to be CCSID 65535 when using FMTOPT(*MAP) copying from or to a UCS-2 graphic field. UCS-2 graphic cannot be CCSID 65535.

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 will be copied correctly. The server will perform 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).