CCSID (Coded Character Set Identifier) keyword

You use this file-, record-, or field-level keyword to specify that a G-type field supports Unicode data instead of DBCS-graphical data. Like DBCS-graphic characters, Unicode code units are two bytes long.

The format of the keyword is:
CCSID(Unicode-CCSID | &Unicode-CCSID-field | *REFC 
      [field-display-length | *MIN | *LEN display-positions])

The Unicode-CCSID parameter is required. Use the Unicode-CCSID parameter to specify a CCSID that uses a Unicode encoding scheme for this field. The Unicode-CCSID parameter can be specified 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.

A special value of *REFC can be specified instead of a Unicode-CCSID value. It is valid only on reference fields, and the referenced field must be coded with a CCSID keyword specifying a Unicode-CCSID value. Normally, the display file CCSID keyword will override any CCSID keyword attributes taken from the referenced field. If *REFC is specified, the Unicode-CCSID value is taken from the referenced field.

The field-display-length parameter is optional and is valid only when the CCSID keyword you specify it at the field level. You specify the field-display-length as the number of Unicode code units.

When Unicode data is involved in an output operation, the data is converted from the associated Unicode CCSID to the CCSID of the device. Generally, the length of the data will change when this conversion occurs. Therefore, you can use the field-display-length value to specify a displayed field length that is different from the default displayed field length. The default displayed field length of a 'G' data type field is twice the number of code units that are specified for the field length.

The field-display-length value can help avoid truncation of field data when the data length will be longer after conversion than the default displayed field length. The field-display-length value can also help increase the available line space by limiting the displayed 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 display file contains the following line:
FLD1         10G  B  2  2 CCSID(X Y)
  • X is the Unicode-CCSID associated with the field data. Y is the field-display-length of this field. If you do not specify Y, then FLD1's length on the screen is 20 single-byte characters (twice the number of code units specified on the field length).
  • If you know that the Unicode data is constructed from single byte data, then you can specify the field-display-length, Y, as 5 Unicode code units. FLD1 will have a length of 10 single byte characters on the screen (twice the number of code units that are specified on the field-display-length).
  • If you know that the Unicode data is constructed from double-byte data, then you can specify the field-display-length, Y, as 11 Unicode code units. FLD1 will have a length of 22 single byte characters on the screen. This will allow space for the shift-out and shift-in characters.

A special value, *MIN, can be specified instead of a field-display-length. This value will be used to specify a field length defined in terms of display positions. This value causes the field length on the screen to be equal to the number of Unicode code units defined in the DDS.

A special value, *LEN, along with a display-positions value can be specified instead of a field-display-length. This value is used to specify a field length defined in terms of display positions. This value causes the field length on the screen to be equal to the display-positions value.

If the CCSID keyword is specified at both the field-level and the record- or file-level, the field-level keyword takes precedence.

On output, field data that is longer than the specified field length is truncated. On input, if too many characters were entered into the Unicode field, then the field is reverse imaged and an error appears on the error line stating too many characters were entered. You need to press reset and correct the field. The maximum number of characters to enter is conveyed in the error message.

The CCSID keyword can be specified with all of the following field level keywords:

ALIAS
AUTO(RA)
BLANKS
CHANGE
COLOR
DFT
DLTCHK
DSPRL
DUP
CHECK(FE)
CHGINPDFT

DFTVAL
DSPATR(BL)
DSPATR(CS)
DSPATR(HI)
DSPATR(MDT)
DSPATR(ND)
DSPATR(PC)
DSPATR(PR)
DSPATR(RI)
DSPATR(UL)
ENTFLDATR

ERRMSG
ERRMSGID
FLDCSRPRG
INDTXT
OVRATR
OVRDTA
PUTRETAIN
REFFLD
SFLCSRPRG
TEXT

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)
00020A          R RECORD1
00030A            FIELD1        30G
00040A            FIELD2        10G         CCSID(61952 6)
00050A          R RECORD2                   CCSID(1200)
00060A            FIELD3        20G
00070A          R RECORD3
00080A            FIELD4        10G         CCSID(61952 *MIN)
00090A            FIELD6        10G         CCSID(1200 *LEN 8)

FIELD1 is assigned a CCSID value of 13488. FIELD2 is assigned a CCSID value of 61952 and has a field length of 6 Unicode code units long (12 SBCS characters). FIELD3 is assigned a CCSID value of 1200. FIELD4 will use 10 display positions on the screen. FIELD6 will use 8 display positions on the screen.