Default File CCSID
When the fopen()
function
is used to open files , the default CCSID of the file is different
depending on whether or not UTF support is used. If UTF support is
not used (that is, if LOCALETYPE(*CLD), LOCALETYPE(*LOCALE), or LOCALETYPE(*LOCALEUCS2)
are specified on the compilation command), the file CCSID defaults
to the current job CCSID. Usually this works well because the job
CCSID is set correctly and the current locale is set to match the
job CCSID.
With UTF support, the job CCSID cannot be set to UTF-8 because
of system limitations. When LOCALETYPE(*LOCALEUTF) is specified,
the file CCSID defaults to the CCSID of the current locale. If the
default locale is being used, the CCSID defaults to UTF-8 (CCSID 1208).
If this default is not desired, the ccsid or o_ccsid keyword
can be specified in the second parameter of the fopen()
call.
However, database files are an exception, because DB2® for IBM® i
does not completely support UTF-8. When SYSIFCOPT(*NOIFSIO) is specified,
and the CCSID of the current locale is 1208, the CCSID of the file
defaults to CCSID 65535 (no conversion) rather than CCSID 1208. This
allows CCSID 1208 to be used with database files. For more information
about file CCSIDs, see fopen() — Open Files.