_SETCCSID()--Set i5/OS PASE CCSID
Syntax
#include <as400_protos.h>
int _SETCCSID(int ccsid);
Default Public Authority: *USE
Library: Standard C Library (libc.a)
Threadsafe: No
Note: This function can only be used in an i5/OS PASE
program. See i5/OS PASE for more
information about creating i5/OS PASE programs.
The _SETCCSID() function returns the previous value of the i5/OS PASE Coded
Character Set Identifier (CCSID) and optionally sets a new i5/OS PASE
CCSID.
Parameters
- ccsid
- (Input) Specifies the new i5/OS PASE CCSID value, or -1 to retrieve the
current i5/OS PASE CCSID without changing it. An i5/OS PASE CCSID must be
either a single-byte ASCII encoding that the ILE version of
iconv can convert to and from the job default CCSID, or 1208
for UTF-8 encoding.
Authorities
_SETCCSID requires no authority.
Return Value
_SETCCSID returns either the original i5/OS PASE CCSID
(before it was changed), or -1 if an error occurred and the i5/OS PASE CCSID
was left unchanged.
Error Conditions
The only error condition that causes a function result of -1 is that the new
ccsid cannot be converted to or from the i5/OS job default CCSID.
Usage Notes
- The initial i5/OS PASE CCSID value is specified as a parameter on the
Qp2RunPase API. The i5/OS PASE CCSID has two primary uses:
- It is used to set the the CCSID attribute of any bytestream file created in
the Integrate File System by an i5/OS PASE program.
- It is used by i5/OS PASE runtime functions to convert character arguments
and results between the i5/OS PASE CCSID and whatever encoding is required by
the i5/OS service used to implement the function.
- The i5/OS PASE CCSID should generally be the CCSID equivalent of the code
set for the current locale. See i5/OS PASE
Locales to determine what locales are supported by i5/OS PASE.
- Character arguments and results for i5/OS PASE runtime functions that use
i5/OS services are almost always automatically converted using the i5/OS PASE
CCSID. For example, the name of a bytestream file passed to the i5/OS PASE
open function is converted from the i5/OS PASE CCSID to the internal encoding
required by the i5/OS Integrated File System.
- Any data an i5/OS PASE program writes to or reads from a file descriptor
for an open bytestream file, socket, FIFO, or pipe is generally not
converted. The only exception is for the initial file descriptors 0, 1, and 2
provided when the Qp2RunPase API is called to start an i5/OS PASE program,
which default to converting file data between the i5/OS PASE CCSID and the job
default CCSID (see Run an i5/OS PASE Program
(Qp2RunPase) for more information).
- Other than special support for file descriptors 0, 1, and 2, i5/OS PASE
runtime does no CCSID conversion of file data. This differs from ILE runtime,
which does CCSID conversion between the file CCSID and job default CCSID for
any file opened in text mode. i5/OS PASE runtime sets the CCSID attribute of
any file it creates to the i5/OS PASE CCSID, so an ILE program that uses text
mode to open an ASCII file created by an i5/OS PASE program can read and write
EBCDIC data.
- The i5/OS PASE runtime functions cstoccsid and ccsidtocs convert between
AIX Character Set names and CCSID values.
Related Information
API introduced: V4R5