ccsidtocs -- Determine Code Page Name for Coded Character Set ID

Format

#include <iconv.h>
char *ccsidtocs(CCSID ccsid);

Language Level: Extension
ccsidtocs returns the corresponding code page name of the CCSID specified by the ccsid parameter. CCSIDs are registered IBM coded character set IDs.

ccsidtocs looks for the ccsid.tbl in the iconv subdirectory in one of the paths specified by the LOCPATH environment variable.

Return Value
If the code page name is returned successfully, then ccsidtocs returns a pointer to the code page name string. If the return is unsuccessful, then ccsidtocs returns a NULL pointer.

The value of errno may be set to:

ENOENT The ccsid table (file ccsid.tbl) cannot be opened.
EOS2ERR I/O error opening or reading the ccsid file.

Example
The following example prints the code page name for all the CCSIDs that define a mapping. This output is the source input used to create the ccsid table; the only missing entries are the ones with duplicate CCSID values.

#include <stdio.h>
#include <iconv.h>
main()
{
   int i = 0;
   char *cs;
   while (++i <= 65535) {
      if ((cs=ccsidtocs(i))!=NULL) {
         printf("%s %i \n", cs, i);
      }
   }
   return 0;
}



cstoccsid -- Determine Coded Character Set ID for Code Page Name