30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

If the length of the from-field is greater than the maximum length of the<br />

variable-length to-field, the length portion of the variable-length to-field is set to<br />

the maximum length of the variable-length to-field. The data from the fixed-length<br />

from-field is copied to the data portion of the variable-length to-field and truncated<br />

on the right in a way that ensures data integrity.<br />

Fixed-Length<br />

Character From-Field<br />

(length of eight)<br />

ABCDEFGH mapped 04ABCD<br />

Fixed-Length DBCS-<br />

Only From-Field<br />

(length of eight)<br />

<br />

mapped<br />

Variable-Length<br />

Character To-Field<br />

(maximum length<br />

of four)<br />

Variable-Length<br />

DBCS-Only To-Field<br />

(maximum length<br />

of four)<br />

04<br />

RV2H085-1<br />

Date, time, and timestamp fields using FMTOPT(*MAP) or<br />

FMTOPT(*NOCHK)<br />

FMTOPT(*MAP) or FMTOPT(*NOCHK) must be specified on the CPYF command<br />

if:<br />

v The from-file is a database data file.<br />

v The to-file is a physical data file.<br />

v The record formats are not identical.<br />

Corresponding date, time, and timestamp fields in the from-file and to-file must<br />

have the same format attribute and separator for the record formats to be identical.<br />

For the CPYFRMQRYF command, the same is true except that the open query file<br />

record format is used (rather than a from-file format).<br />

When using FMTOPT(*NOCHK), record data is copied directly from left to right<br />

into the to-file without any regard to field types.<br />

When using FMTOPT(*CVTSRC), data portions of records are directly copied from<br />

left to right into the to-file without any regard to the field types.<br />

When using FMTOPT(*DROP), fields in the from-file but not in the to-file are<br />

dropped. If any like-named fields in the from-file and to-file are date, time, or<br />

timestamp fields, the corresponding field must be the same type, have the same<br />

format attribute and separator, and have the same relative position in the record<br />

format as the like-named field, otherwise FMTOPT(*MAP) may also be required.<br />

FMTOPT(*MAP) allows copying between like date, time, and timestamp field<br />

types regardless of the format or separator. Also, copies from and to date, time,<br />

and timestamp fields are allowed from and to zoned-decimal or character field<br />

types, provided the lengths, formats, and values can be converted.<br />

FMTOPT(*MAP) is required in this case for conversion to the to-field type (format<br />

and separator, if it applies).<br />

Chapter 4. Copying files 111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!