_OPEN_CCSID()--Open With CCSID for IBM PASE for i


  Syntax
 #include <as400_protos.h>

 int _OPEN_CCSID(const char *path,
                 int        oflags,
                 mode_t     mode,
                 int        ccsid);

  Default Public Authority: *USE

  Library: Standard C Library (libc.a)

  Threadsafe: No

Note: This function can only be used in an IBM® i PASE program. See the IBM PASE for i topic collection for more information about creating IBM PASE for i programs.

The _OPEN_CCSID function establishes a connection between the file named by the path parameter and a file descriptor. _OPEN_CCSID works the same as the IBM PASE for i open function, except that any file it creates is tagged with a specified Coded Character Set Identifier (CCSID).


Parameters

path
(Input) Specifies the address of a null-terminated character string (in the current IBM PASE for i CCSID) that contains the path name of the file to open.
oflags
(Input) Specifies the the type of access, special open processing, type of update, and initial state of the open file. See AIX ® documentation for the open function for more information about oflags.
mode
(Input) the read, write, and execute permissions of the file to be created (requested by the O_CREAT flag). If the file already exists, this parameter is ignored. See AIX documentation for the open function for more information about mode.
ccsid
(Input) Specifies the IBM PASE for i CCSID value that describes the data that will be stored in a file created by _OPEN_CCSID. If zero is specified, the current IBM PASE for i CCSID is used. If the file already exists, this parameter is ignored.

Authorities

See documenation for the ILE open()--Open File function for information about required authorities.


Return Value

_OPEN_CCSID returns either the file descriptor for the open file, or -1 if an error occurred. The errno variable is set to indentify the specific error.


Error Conditions

See AIX documentation for the open function and ILE open()--Open File function for more information about error conditions.


Usage Notes

  1. ILE runtime uses the CCSID tag for a file to control automatic conversion for data read or written through a file opened in text mode. Any data an IBM PASE for i program writes to or reads from a file descriptor 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 IBM PASE for i program, which default to converting file data between the IBM PASE for i CCSID and the job default CCSID (see Qp2RunPase()--Run an IBM PASE for i Program for more information).

  2. Other than special support for file descriptors 0, 1, and 2, IBM PASE for i 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.

  3. The IBM PASE for i runtime functions cstoccsid and ccsidtocs convert between AIX Character Set names and CCSID values.


Related Information



API introduced: V5R4

[ Back to top | IBM PASE for i APIs | APIs by category ]