Using containers for code page conversion

Your applications can use the container API to convert character data from one code page to another.

About this task

The following example converts data from code page1 to code page2 :

EXEC CICS PUT CONTAINER(
temp
) DATATYPE(DFHVALUE(CHAR))
FROMCCSID(
code page1
) FROM(
input-data
)
EXEC CICS GET CONTAINER(
temp
) INTOCCSID(
code page2
)
SET(
data-ptr
) FLENGTH(
data-len
)
The following example converts data from the region's default EBCDIC code page to a specified UTF8 code page:

EXEC CICS PUT CONTAINER(
temp
) DATATYPE(DFHVALUE(CHAR))
FROM(
ebcdic-data
)
EXEC CICS GET CONTAINER(
temp
) INTOCCSID(utf8_ccsid)
SET(
utf8-data-ptr
) FLENGTH(
utf8-data-len
)

When using the container API in this way, bear the following in mind:
  • On GET CONTAINER commands, use the SET option, rather than INTO, unless the converted length is known. (You can retrieve the length of the converted data by issuing a GET CONTAINER( cont_name ) NODATA FLENGTH( len ) command.)
  • If you prefer to specify a supported IANA charset name for the code pages, rather than the decimal CCSIDs, or if you want to specify a CCSID alphanumerically, use the FROMCODEPAGE and INTOCODEPAGE options instead of the FROMCCSID and INTOCCSID options.
  • To avoid a storage overhead, after conversion copy the converted data and delete the container.
  • To avoid shipping the channel, use a temporary channel. For more information about temporary storage and use of channels, see Avoiding affinities when using temporary storage.
  • All-to-all conversion is not possible. That is, a code page conversion error occurs if a specified code page and the channel's code page are an unsupported combination.