_OPEN_CCSID()--Open With CCSID for i5/OS PASE


  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 i5/OS PASE program. See i5/OS PASE for more information about creating i5/OS PASE 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 i5/OS PASE 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 i5/OS PASE 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 i5/OS PASE CCSID value that describes the data that will be stored in a file created by _OPEN_CCSID. If zero is specified, the current i5/OS PASE CCSID is used. If the file already exists, this parameter is ignored.

Authorities

See documenation for the ILE Open File (open) 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 File (open) 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 i5/OS PASE 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 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).

  2. 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.

  3. The i5/OS PASE runtime functions cstoccsid and ccsidtocs convert between AIX Character Set names and CCSID values.


Related Information



API introduced: V5R4
Top | i5/OS PASE APIs | APIs by category