Map considerations using Copy

When mapping a character field to a date, time, or timestamp field and a format form is being used in the character field, leading zeros can be omitted from month, day, and hour parts. Microseconds can be truncated or omitted entirely in the character field.

For mapping to time fields, the seconds part (and corresponding separator) can be omitted from the character field.

For *USA form values, the AM or PM with a preceding blank is required. These rules are also true for date, time, or timestamp values that are entered when using FROMKEY with *BLDKEY, TOKEY with *BLDKEY, or INCREL parameters on the CPYF command. All other instances of date, time, and timestamp data require leading zeros when necessary and no truncation.

For both forms of the TOKEY parameter (*BLDKEY or non-*BLDKEY) the from-field data must be in a particular format for a chronological comparison to be made. For the date field, you must use the *ISO or *JIS format to make a chronological comparison. For the time fields, you must use the *HMS, *ISO, *EUR, or *JIS formats to make the chronological comparison. For any other formats of date or time fields (for date (*MDY, *DMY, *YMD, *JUL, *EUR, or *USA) or for time (*USA)), chronological comparisons are not possible because the TOKEY parameter performs a straight character string comparison. When you cannot make chronological comparisons, the system sends an informational message, and the copy operation continues.

When copying data into a file with date, time, or timestamp fields, and the from-file is a device file or FMTOPT(*NOCHK) or FMTOPT(*CVTSRC) has been specified, output mapping errors might occur if the data copied to a date, time, or timestamp field is not valid data for the to-file field format and separator attributes. You cannot copy the record if this occurs. If you use the CPYF or CPYFRMQRYF command, you can specify an error level other than zero (ERRLVL parameter) to bypass the record and continue the copy operation. When copying into date, time, or timestamp fields in these instances, it is important that the from-file data is valid for the to-file.