Converting universal coded character set (UCS-2) graphic fields

 

You can use FMTOPT(*MAP) to convert universal coded character set (UCS-2) graphic fields.

Using FMTOPT(*MAP) to copy to a UCS-2 graphic field converts the data in the from-field CCSID to the CCSID of the UCS-2 graphic to-field. If the length after conversion is less than the length of the UCS-2 graphic to-field, the field is padded . If the length after conversion is greater than the length of the UCS-2 graphic to-field, the field is truncated.

Using FMTOPT(*MAP) to copy from a UCS-2 graphic field converts the data from the CCSID of the UCS-2 graphic field to the CCSID of the to-field. If the length after conversion is less than the length of the to-field, the field is padded. If the length after conversion is greater than the length of the to-field, the field is truncated. Shift-out and shift-in characters are added around double-byte data except in DBCS-graphic and UCS-2 graphic fields.

UCS-2 conversion possibilities also include variable length fields. Generally, the result length of a variable length to-field will be the minimum of the from-field converted length and the maximum length of the to-field.

The CCSID conversions created when copying from or to a UCS-2 graphic field might cause the byte length of the data to be different after the conversion. The maximum length of the to-field is used to determine if all of the converted data will fit in the to-field.

When copying from a UCS-2 graphic field to a character field, or to a DBCS-either field where the first byte is already converted to a valid SBCS character (not a shift-out X'0E'), any remaining characters that cannot be converted to SBCS (actual double-byte data in the UCS-2 field) will have a single-byte substitution character set in its place.

When copying from a UCS-2 graphic field to a DBCS-only, DBCS-graphic field, or to a DBCS-either field where the first byte is already converted to a DBCS shift-out (X'0E'), any remaining characters that cannot be converted to DBCS will have a double-byte substitution character set in its place.

To be successful when using FMTOPT(*MAP) to convert from or to UCS-2 data, the resulting converted data for the to-field must conform to the to-field type. Otherwise, conversion errors will occur and the to-field will be set to its default value.

 

Parent topic:

Copying between different database record formats (FMTOPT parameter)