Your applications can use the container API as a simple means
of converting character data from one code page to another. The following
example converts data from
codepage1 to
codepage2:
EXEC CICS PUT CONTAINER(temp) DATATYPE(DFHVALUE(CHAR))
FROMCCSID(codepage1) FROM(input-data)
EXEC CICS GET CONTAINER(temp) INTOCCSID(codepage2)
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.)
- To avoid a storage overhead, after conversion copy the converted data
and delete the container.
- To avoid shipping the channel, use a temporary channel.
- 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.