Coded character set identifier keyword

Use this file-, record-, or field-level keyword to specify that a G-type field supports UTF-16 data instead of DBCS-graphical data. Each UTF-16 code unit (which includes UCS-2 characters) is two bytes long.

The format of the keyword is:

CCSID(UTF16-CCSID | &UTF16-CCSID-field | *REFC
      [*CONVERT | *NOCONVERT]
      [alternate-field-length])

The UTF16-CCSID parameter is required. Use the UTF16-CCSID parameter to specify a CCSID (coded character set identifier) that uses the UTF-16 encoding scheme for this field. You can specify the UTF16-CCSID parameter either as a number up to 5 digits long or as a program-to-system field. You must define the program-to-system field with a length of 5 and with the S data type.

You can specify a special value of *REFC instead of a UTF16-CCSID value. It is only valid on reference fields, and you must code the referenced field with a CCSID keyword that specifies a UTF16-CCSID value. Normally, the printer file CCSID keyword overrides any CCSID keyword attributes taken from the referenced field. If you specify *REFC, the UTF16-CCSID value comes from the referenced field.

The *CONVERT parameter is optional and specifies whether the UTF-16 data is converted to a target CCSID specified on the CHRID parameter of the CRTPRTF, CHGPRTF, or OVRPRTF commands. *CONVERT is the default. If you specify the CCSID keyword with *NOCONVERT, the UTF-16 data is not converted to the target CCSID.

If *NOCONVERT is active for a printer file whose DEVTYPE is *AFPDS, the application must also use either a TrueType font or one of the AFP™ Unicode migration fonts. If you do not specify either a TrueType font or one of the AFP Unicode migration fonts, the output will be interpreted as single-byte data and will probably be unprintable.

If *NOCONVERT is active for a printer file whose DEVTYPE is *LINE or *AFPDSLINE, the application must also use one of the AFP Unicode migration fonts. If you do not specify an AFP Unicode migration font, the output will be interpreted as single-byte data and will probably be unprintable.

If *NOCONVERT is active and the file DEVTYPE is *AFPDS, specify a TrueType font with the FONTNAME keyword, or specify an AFP Unicode migration font character set and code page with the FNTCHRSET keyword. If the file DEVTYPE is *LINE or *AFPDSLINE, specify the AFP Unicode migration font character set and code page in the page definition for the printer file.

If *NOCONVERT is specified for a printer file whose DEVTYPE is *SCS, a diagnostic message is issued when the printer file is used, and the UTF-16 data is converted to the target CCSID.

The alternate-field-length parameter is optional and is valid only when you specify the CCSID keyword at the field level and the *CONVERT parameter is active. Specify the alternate-field-length as the number of UTF-16 code units.

When UTF-16 data is involved in an output operation and the *CONVERT parameter is active, the data is converted from the associated UTF-16 CCSID to the target CCSID. Generally, the length of the data will change when this conversion occurs. Therefore, you can use the alternate-field-length value to specify a printed field length that is different from the default printed field length. The default printed field length of a 'G' data type field is twice the number of characters that are specified for the field length.

The alternate-field-length value can help avoid truncation of field data when the data length will be longer after conversion than the default printed field length. The alternate-field-length value can also help increase the available line space by limiting the printed field length when the data length will be shorter after conversion. The field length will still be used to define the field's output buffer length.

For example, a printer file contains the following information:

FLD1         10G     2  2 CCSID(X Y)

If you specify the CCSID keyword at the field-level and either the record- or the file-level, the field-level keyword takes precedence. If the you specify the CCSID keyword at the file- or record-level and no G-type fields exist, then the keyword is ignored.

On output, field data that is longer than the specified field length is truncated.

The CCSID keyword is not valid for files whose DEVTYPE is *IPDS.

You can specify the CCSID keyword with all keywords that are currently allowed on a G-type field.

Option indicators are not valid for this keyword.

Example

The following example shows how to specify the CCSID keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      CCSID(13488)
00010A          R RECORD1
00020A            FIELD1        30G
00030A            FIELD2        10G         CCSID(1200 *CONVERT 6)
00010A          R RECORD2                   CCSID(1200 *NOCONVERT)
00020A            FIELD3        20G
     A

FIELD1 is assigned a CCSID value of 13488. FIELD2 is assigned a CCSID value of 1200 and has a field length of 6 UTF-16 code units (12 SBCS characters). FIELD3 is assigned a CCSID value of 1200, and the data is not converted during an output operation.