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.

For the first CPYF command, MBROPT(*ADD) is specified, so an escape message<br />

is not sent to the program because of the empty from-file member. Note that if<br />

MBR1 does not exist before the copy, it is added to the to-file (if either the from-file<br />

member is empty or contains data).<br />

For the second CPYF command, copy does not clear the to-file member when the<br />

from-file member is empty, so the MONMSG command after the second CPYF<br />

command starts the CLRPFM command to clear the to-file member when the<br />

from-file member is empty.<br />

For the third CPYF command, the CPF2817 escape message has compare data of<br />

CPF2870 if all members to be copied are empty because the generic from-file<br />

member name, EMPTY*, requests that multiple members be copied.<br />

Creating a duplicate to-file member<br />

When your application requires an exact duplicate of the records in the to-file<br />

member (if either the from-file is empty or contains data), an alternative solution is<br />

to use the Clear Physical <strong>File</strong> Member (CLRPFM) command:<br />

CLRPFM FILE(X) MBR(XYZ)<br />

CPYF FROMFILE(Y) TOFILE(X) TOMBR(XYZ) +<br />

MBROPT(*ADD)<br />

Because MBROPT(*ADD) is specified, the CPYF command completes normally<br />

even if there is no data in file Y. MBR(XYZ) in file X contains an exact duplicate of<br />

the records in the member in file Y.<br />

CPYFRMQRYF command support for CCSIDs<br />

The Copy from Query <strong>File</strong> (CPYFRMQRYF) command provides CCSID conversions<br />

for character and DBCS fields. The Open Query <strong>File</strong> (OPNQRYF) command<br />

converts all character and DBCS fields to the current job CCSID, except for fields<br />

that have a CCSID of 65535 or where *HEX is specified on the MAPFLD<br />

parameter. If the current job CCSID is 65535, then no conversions are done by<br />

OPNQRYF. The CPYFRMQRYF command may also do conversions to the to-file<br />

field CCSIDs, so it is possible that double conversions will be done and data may<br />

be lost. To avoid the possibility of doing double conversions, change the job CCSID<br />

to 65535 before doing an OPNQRYF if you plan to do a CPYFRMQRYF.<br />

CPYFRMQRYF uses a different query format. It is the same as the open query file<br />

format except for the CCSIDs for character and DBCS fields. The CCSIDs in this<br />

query format are determined according to the following:<br />

v If the OPNQRYF job CCSID is 65535, all character and DBCS fields in the query<br />

format have the same CCSIDs as the open query file format.<br />

v If the OPNQRYF job CCSID is not 65535, all character and DBCS fields in the<br />

query format have their CCSIDs reset to the associated single-byte, mixed or<br />

double-byte CCSIDs of the OPNQRYF job CCSID, based on the field type. Fields<br />

with a CCSID of 65535 remain unchanged. If there is no associated mixed or<br />

double-byte CCSID for the OPNQRYF job CCSID, 65535 is used.<br />

You can find more information on CCSIDs in the National Language Support book.<br />

Chapter 4. Copying files 81

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

Saved successfully!

Ooh no, something went wrong!