|
CEE3CTY sets the default
country. A calling routine can change or query the current national
country setting. The country setting affects the date format, the
time format, the currency symbol, the decimal separator, and the thousands
separator.
The current national country setting also affects
the format of the date and time in the reports generated by the RPTOPTS
and RPTSTG runtime
options.
CEE3CTY also affects the default symbols for the NLS and date and time callable
services.
CEE3CTY affects only the Language Environment NLS and
date and time services, not the Language Environment locale
callable services or C locale-sensitive
functions.
The current default country setting, as well as
previous default settings that have not been discarded, are stored
on the stack on a LIFO (last in, first out) basis. The current default
country setting is always on the top of the stack.
There are
two methods of changing the default country setting with CEE3CTY:
- Specify the new default country setting and place it on top of
the stack using a function value of 1 (SET).
This discards the previous default setting.
- Specify the new default country setting and place it on top of
the stack using a function value of 3 (PUSH).
This pushes the previous default setting down on the stack so that
you can later retrieve it by discarding the current setting.
To illustrate the second method, suppose you live in
the United States and the code for the United States is specified
as the default at installation. If you want to use the French defaults
for a certain application, you can use CEE3CTY to PUSH France as
the default country setting; then when you want the defaults for the
United States, you can POP France from the top of the stack, making
the United States the default setting.
Syntax
>>-CEE3CTY--(--function--,--country_code--,--fc--)-------------><
- function (input)
- A fullword binary integer specifying the service to be performed.
The possible values for function are:
- 1—SET
- Establishes the country_code parameter
as the current country. The top of the stack is, in effect, replaced
with country_code.
- 2—QUERY
- Returns the current
country code on the top of the stack to the calling routine. The
current code is returned in the country_code parameter.
- 3—PUSH
- Pushes the country_code parameter onto
the top of the country code stack, making it the
current country code. Previous country codes on the stack are retained
on a LIFO basis, which makes it possible to return to a prior country
code at a later time.
- 4—POP
- Pops the current
country code. The last country code that was affected by a PUSH now
becomes the current country_code. On return
to the calling routine, the country_code parameter
contains the discarded country code. If the stack contains only one
country code, the code cannot be popped because the stack would be
empty after the call. Therefore, no action is taken and a feedback
code indicating such is returned to the calling routine.
- country_code (input/output)
- A 2-character fixed-length string. country_code is
not case-sensitive. Table 1 contains
a list of valid country codes. It is used in the following ways for
the different functions:
If function is: |
then country_code: |
---|
1 or 3 |
Contains the desired 2-character country code. In this case,
it is an input parameter. Table 1 contains
a list of valid country codes. |
2 |
Returns the current 2-character country code on top of the
stack. In this case, it is an output parameter. |
4 |
Returns the discarded 2-character country code. In this case,
it is an output parameter. |
- fc (output)
- A 12-byte feedback code, optional in some languages,
that indicates the result of this service. If you choose to omit this
parameter, refer to Invoking callable services for the
appropriate syntax to indicate that the feedback code was omitted.
The
following symbolic conditions can result from this service:
Code |
Severity |
Message number |
Message text |
---|
CEE000 |
0 |
— |
The service completed successfully. |
CEE3BV |
2 |
3455 |
Only one country code was on the stack when a POP request was
made to CEE3CTY. The current country code was returned in the |
CEE3C0 |
3 |
3456 |
The country code country-code for the PUSH
or SET function for CEE3CTY was invalid. No operation was performed. |
CEE3C1 |
3 |
3457 |
The function function specified for CEE3CTY
was not recognized. No operation was performed. |
Usage notes - The default setting for country_code is
already on the stack when you start a program. You do not have to
PUSH it there.
- The bytes X'0E' and X'0F' representing shift-out
and shift-in codes are not affected by any country_code setting.
- C/C++ consideration—Language Environment provides
locales used in C and C++ to establish
default formats for the locale-sensitive functions and locale callable
services, such as date and time formatting, sorting, and currency
symbols. To change the locale, you can use the setlocale() library
function or the CEESETL callable service.
The
settings of CEESETL or setlocale() do not affect
the setting of the CEE3CTY callable service. CEE3CTY affects only Language Environment NLS and
date and time services. setlocale() and CEESETL affect
only C/C++ locale-sensitive
functions and Language Environment locale
callable services.
To ensure that all settings are correct
for your country, use CEE3CTY and either CEESETL or setlocale().
- z/OS UNIX consideration—CEE3CTY
applies to the enclave. Every thread in the enclave has the same country
setting.
For more information - For more information about the RPTOPTS and RPTSTG runtime options, see RPTOPTS and RPTSTG.
- For a list of the default settings for a specified country, see Table 1.
- For more information about the COUNTRY runtime option, see COUNTRY.
- For more information about setlocale(), see z/OS XL C/C++ Programming Guide.
Examples - Following is an example of CEE3CTY called by C/C++.
/*Module/File Name: EDC3CTY */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <leawi.h>
#include <ceeedcct.h>
int main(void) {
_FEEDBACK fc;
_INT4 function;
_CHAR2 country;
/* query the current country setting */
function = 2; /* function 2 is query */
CEE3CTY(&function,country,&fc);
if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
printf("CEE3CTY failed with message number %d\n",
fc.tok_msgno);
exit(2999);
}
/* if the current country is not Canada then set */
/* it to Canada */
if (memcmp(country,"CA",2) != 0) {
memcpy(country,"CA",2);
function = 1; /* function 1 is set */
CEE3CTY(&function,country,&fc);
if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
printf("CEE3CTY failed with message number %d\n",
fc.tok_msgno);
exit(2999);
}
}
}
- Following is is an example of CEE3CTY called by COBOL.
CBL LIB,QUOTE
*Module/File Name: IGZT3CTY
************************************************
** **
** Function: CEE3CTY - set default country **
** **
************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CBL3CTY.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FUNCTN PIC S9(9) BINARY.
01 COUNTRY PIC X(2).
01 FC.
02 Condition-Token-Value.
COPY CEEIGZCT.
03 Case-1-Condition-ID.
04 Severity PIC S9(4) BINARY.
04 Msg-No PIC S9(4) BINARY.
03 Case-2-Condition-ID
REDEFINES Case-1-Condition-ID.
04 Class-Code PIC S9(4) BINARY.
04 Cause-Code PIC S9(4) BINARY.
03 Case-Sev-Ctl PIC X.
03 Facility-ID PIC XXX.
02 I-S-Info PIC S9(9) BINARY.
PROCEDURE DIVISION.
PARA-3CTYQRY.
************************************************
** Call CEE3CTY with the QUERY function,
** and display current country code.
************************************************
MOVE 2 TO FUNCTN.
CALL "CEE3CTY" USING FUNCTN, COUNTRY, FC.
IF CEE000 of FC THEN
DISPLAY "THE CURRENT COUNTRY CODE IS "
COUNTRY
ELSE
DISPLAY "CEE3CTY(query) failed with msg "
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
PARA-3CTYSET.
************************************************
** If the current country code is not the US,
** call CEE3CTY with the SET function to make
** it the US. Display result.
************************************************
IF ( COUNTRY IS NOT = "US" ) THEN
MOVE 1 TO FUNCTN
MOVE "US" TO COUNTRY
CALL "CEE3CTY" USING FUNCTN,
COUNTRY, FC
IF CEE000 of FC THEN
DISPLAY "THE NEW COUNTRY CODE IS ",
COUNTRY
ELSE
DISPLAY "CEE3CTY(set) failed with msg "
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF
END-IF.
GOBACK.
- Following is an example of CEE3CTY called by PL/I.
*PROCESS MACRO;
/* Module/File Name: IBM3CTY */
/****************************************************/
/** **/
/** Function: CEE3CTY - set current country **/
/** **/
/** In this example, a call is made to the query **/
/** function of CEE3CTY to return the current **/
/** default country setting. This is then **/
/** printed out. If the current country code is **/
/** not 'US', then it is set to 'US' and printed. **/
/** **/
/****************************************************/
PLI3CTY: PROC OPTIONS(MAIN);
%INCLUDE CEEIBMAW;
%INCLUDE CEEIBMCT;
DCL FUNCTN REAL FIXED BINARY(31,0);
DCL COUNTRY CHARACTER ( 2 );
DCL 01 FC, /* Feedback token */
03 MsgSev REAL FIXED BINARY(15,0),
03 MsgNo REAL FIXED BINARY(15,0),
03 Flags,
05 Case BIT(2),
05 Severity BIT(3),
05 Control BIT(3),
03 FacID CHAR(3), /* Facility ID */
03 ISI /* Instance-Specific Information */
REAL FIXED BINARY(31,0);
FUNCTN = 2; /* Specify 2 for the query function */
/* Call CEE3CTY with the query function to */
/* return the current country setting */
CALL CEE3CTY ( FUNCTN, COUNTRY, FC );
/* If CEE3CTY ran successfully, print the */
/* current country */
IF FBCHECK( FC, CEE000) THEN DO;
PUT SKIP LIST( 'The current country code is "'
|| COUNTRY || '".' );
END;
ELSE DO;
DISPLAY( 'CEE3CTY failed with msg '
|| FC.MsgNo );
STOP;
END;/* If the current default country is not the US, */
/* set it to the US */
IF COUNTRY ¬= 'US' THEN DO;
FUNCTN = 1; /* Specify 1 for the set function */
COUNTRY = 'US'; /* Specify country code for US*/
CALL CEE3CTY ( FUNCTN, COUNTRY, FC );
/* If CEE3CTY ran successfully print the */
/* current country */
IF FBCHECK( FC, CEE000) THEN DO;
PUT SKIP LIST( 'The new country code is "'
|| COUNTRY || '".' );
END;
ELSE DO;
DISPLAY( 'CEE3CTY failed with msg '
|| FC.MsgNo );
STOP;
END;
END;
END PLI3CTY;
|