Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
116 <strong>File</strong> <strong>Management</strong> V4R5<br />
(including the shift-out and shift-in characters). This difference is accounted for<br />
when mapping variable-length graphic fields to or from variable bracketed DBCS<br />
fields.<br />
When using the CPYF command with FMTOPT(*MAP) to copy a DBCS-open field<br />
to a graphic field, a conversion error occurs if the DBCS-open field contains any<br />
SBCS data (including blanks). When copying to a graphic field, it may be desirable<br />
to ignore trailing SBCS blanks that follow valid DBCS data (in a DBCS-open field).<br />
This allows the copy operation to be done without a conversion error. This type of<br />
copy may be done using a combination of the OPNQRYF and CPYFRMQRYF<br />
commands. The OPNQRYF command is used to remove trailing single-byte blanks<br />
and place the data into a variable-length DBCS-open field. The CPYFRMQRYF<br />
command with FMTOPT(*MAP) specified is used to copy the variable-length<br />
DBCS-open field to the graphic field.<br />
For example, assume the DBCS-open fields in the file named FILEO are copied into<br />
graphic fields in the file named FILEG. An additional file (FILEV) must be created.<br />
The DDS for the original from-file FILEO:<br />
******* ************** Beginning of data *****************************<br />
A R FMT01<br />
A FLD1 10O CCSID(65535)<br />
A FLD2 7O CCSID(65535)<br />
A FLD3 20A<br />
******* ***************** End of data ********************************<br />
DDS for FILEV: This file’s format will be specified on the OPNQRYF command<br />
FORMAT parameter. The only difference from FILEO is that the DBCS-open fields<br />
to be converted to graphic fields are defined to be variable length.<br />
******* ************** Beginning of data *****************************<br />
A R FMT01<br />
A FLD1 10O VARLEN CCSID(65535)<br />
A FLD2 7O VARLEN CCSID(65535)<br />
A FLD3 20A<br />
******* ***************** End of data ********************************<br />
DDS for the new file FILEG: The graphic fields are defined as fixed length;<br />
however, they could be made variable length, if desired.<br />
******* ************** Beginning of data ************************<br />
A R FMT01<br />
A FLD1 4G CCSID(65535)<br />
A FLD2 3G CCSID(65535)<br />
A FLD3 20A<br />
******* ***************** End of data ***************************<br />
The following commands are used to copy the data from the DBCS-open fields in<br />
FILEO to the graphic fields in FILEG:<br />
CHGJOB CCSID(65535)<br />
OPNQRYF FILE((MYLIB/FILEO))<br />
FORMAT(MYLIB/FILEV *ONLY)<br />
MAPFLD((FLD1 '%STRIP(1/FLD1 *TRAIL)')<br />
(FLD2 '%STRIP(1/FLD2 *TRAIL)'))<br />
CPYFRMQRYF FROMOPNID(FILEO) TOFILE(MYLIB/FILEG)<br />
MBROPT(*REPLACE) FMTOPT(*MAP)