Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Accessing the active locale and code-page values

To verify the locale that is in effect at compile time, check the last few lines of the compiler listing.

For some applications, you might want to verify the locale and the EBCDIC code page that are active at run time, and convert a code-page ID to the corresponding CCSID. You can use callable library routines to perform these queries and conversions.

To access the locale and the EBCDIC code page that are active at run time, call the library function _iwzGetLocaleCP as follows:

CALL “_iwzGetLocaleCP” USING output1, output2

The variable output1 is an alphanumeric item of 20 characters that represents the null-terminated locale value in the following format:

For example, en_US.IBM-1252 is the locale value of language code en, country code US, and code page IBM-1252.

The variable output2 is an alphanumeric item of 10 characters that represents the null-terminated EBCDIC code-page ID in effect, such as IBM-1140.

To convert a code-page ID to the corresponding CCSID, call the library function _iwzGetCCSID as follows:

CALL “_iwzGetCCSID” USING input, output RETURNING returncode

input is an alphanumeric item that represents a null-terminated code-page ID.

output is a signed 4-byte binary item, such as one defined as PIC S9(5) COMP-5. Either the CCSID that corresponds to the input code-page ID string or the error code of -1 is returned.

returncode is a signed 4-byte binary data item, which is set as follows:

0
Successful.
1
The code-page ID is valid but does not have an associated CCSID; output is set to -1.
-1
The code-page ID is not a valid code page; output is set to -1.

To call these services, you must use the SYSTEM call interface convention and the PGMNAME(MIXED) and NODYNAM compiler options.

Example: get and convert a code-page ID

related tasks
Setting the locale

related references
CALLINT
DYNAM
PGMNAME
Compiler-directing statements
SYSTEM


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)