CEEQDTC—Query locale date and time conventions
CEEQDTC, analogous to the C language function localdtconv(), queries the date and time conventions from the current locale and sets the components of a structure with values appropriate to the settings for the LC_TIME category. CEEQDTC is sensitive to the locales set by setlocale() or CEESETL, not to the Language Environment settings from COUNTRY or CEE3CTY.
Syntax >>-CEEQDTC--(--version--,--localdt--,--fc--)-------------------><
- version
- This parameter points to a user supplied VERSION_INFO structure,
in which the first four bytes contain the callable service version
number.
Requirement: If the parameter does not points to a user supplied VERSION_INFO structure, it must be omitted.
If the parameter points to a VERSION_INFO containing version number 1, CEEQDTC returns a DTCONV structure with the new element showing the format of the ISO 8601:2000 standard date. If the parameter is omitted, CEEQDTC returns the DTCONV format used before C99. For information about how to code this parameter, see Invoking callable services. - localdt (output)
- A pointer to the data structure containing the date and time formatting
information from the current, active locale. The fields used to populate
the structure come from the LC_TIME category. The LC_TIME category
structure fields used to retrieve the date and time values are:
- abmon
- Abbreviated month names (12 instances of a halfword length-prefixed character string, VSTRING, of 22 bytes)
- mon
- Month names (12 instances of a halfword length-prefixed character string, VSTRING, of 62 bytes)
- abday
- Abbreviated day names (7 instances of a halfword length-prefixed character string, VSTRING, of 22 bytes)
- day
- Day names (7 instances of a halfword length-prefixed character string, VSTRING, of 62 bytes)
- d_t_fmt
- Date and time format (1 instance of a halfword length-prefixed character string, VSTRING, of 82 bytes)
- d_fmt
- Date format (1 instance of a halfword length-prefixed character string, VSTRING, of 42 bytes)
- t_fmt
- Time format (1 instance of a halfword length-prefixed character string, VSTRING, of 42 bytes)
- am_fmt
- AM string (1 instance of a halfword length-prefixed character string, VSTRING, of 22 bytes)
- pm_fmt
- PM string (1 instance of a halfword length-prefixed character string, VSTRING, of 22 bytes)
- t_fmt_ampm
- Time format ampm (1 instance of a halfword length-prefixed character string, VSTRING, of 42 bytes)
- ISO_STD8601_2000
- ISO8601:2000 standard date format (1 instance of a halfword length-prefixed character string, VSTRING, of 42 bytes)
- 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. CEE3T1 3 4001 General Failure: Service could not be completed. CEE3VN 3 4087 Input Error: The version_info control block contains a version number that is not valid.
Usage notes
- PL/I MTF consideration—CEEQDTC is not supported in PL/I MTF applications.
- If no call to CEESETL has been made, the default locale values to be used are determined at installation time for Language Environment.
- This callable service uses the C/C++ runtime library. The C/C++ library must be installed and accessible even when this service is called from a non-C program.
For more information
- See CEESETL—Set locale operating environment for more information about the current locale.
Examples
- Following is an example of CEEQDTC called by COBOL.
CBL LIB,QUOTE *Module/File Name: IGZTQDTC ************************************************** * Example for callable service CEEQDTC * * MAINQDTC - Retrieve date and time convention * * structures for two countries and * * compare an item. * * Valid only for COBOL for MVS & VM Release 2 * * or later. * ************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. MAINQDTC. DATA DIVISION. WORKING-STORAGE SECTION. * Use DTCONV structure for CEEQDTC calls COPY CEEIGZDT. * PROCEDURE DIVISION. * Subroutine needed for addressing CALL "COBQDTC" USING DTCONV. STOP RUN. * IDENTIFICATION DIVISION. PROGRAM-ID. COBQDTC. DATA DIVISION. WORKING-STORAGE SECTION. 01 Locale-Name. 02 LN-Length PIC S9(4) BINARY. 02 LN-String PIC X(256). * Use Locale category constants COPY CEEIGZLC. * 01 Test-Length1 PIC S9(4) BINARY. 01 Test-String1 PIC X(80). 01 Test-Length2 PIC S9(4) BINARY. 01 Test-String2 PIC X(80). 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. * LINKAGE SECTION. * Use Locale structure DTCONV for CEEQDTC calls COPY CEEIGZDT. * PROCEDURE DIVISION USING DTCONV. * Set up locale for France MOVE 4 TO LN-Length. MOVE "FFEY" TO LN-String (1:LN-Length). * Call CEESETL to set all locale categories CALL "CEESETL" USING Locale-Name, LC-ALL, FC. * Check feedback code IF Severity > 0 DISPLAY "Call to CEESETL failed. " Msg-No EXIT PROGRAM END-IF. * Call CEEQDTC for French values CALL "CEEQDTC" USING OMITTED, ADDRESS OF DTCONV, FC. * Check feedback code IF Severity > 0 DISPLAY "Call to CEEQDTC failed. " Msg-No EXIT PROGRAM END-IF. * Save date and time format for FFEY locale MOVE D-T-FMT-Length IN DTCONV TO Test-Length1 MOVE D-T-FMT-String IN DTCONV TO Test-String1 * Set up locale for French Canadian MOVE 4 TO LN-Length. MOVE "FCEY" TO LN-String (1:LN-Length). * Call CEESETL to set locale for all categories CALL "CEESETL" USING Locale-Name, LC-ALL, FC. * Check feedback code IF Severity > 0 DISPLAY "Call to CEESETL failed. " Msg-No EXIT PROGRAM END-IF. * Call CEEQDTC again for French Canadian values CALL "CEEQDTC" USING OMITTED, ADDRESS OF DTCONV, FC. * Check feedback code and display results IF Severity = 0 * Save date and time format for FCEY locale MOVE D-T-FMT-Length IN DTCONV TO Test-Length2 MOVE D-T-FMT-String IN DTCONV TO Test-String2 IF Test-String1(1:Test-Length1) = Test-String2(1:Test-Length2) DISPLAY "Same date and time format." ELSE DISPLAY "Different formats." DISPLAY Test-String1(1:Test-Length1) DISPLAY Test-String2(1:Test-Length2) END-IF ELSE DISPLAY "Call to CEEQDTC failed. " Msg-No END-IF. EXIT PROGRAM. END PROGRAM COBQDTC. * END PROGRAM MAINQDTC.
- Following is an example of CEEQDTC called by PL/I.
*PROCESS MACRO; /*Module/File Name: IBMQDTC */ /****************************************************/ /* Example for callable service CEEQDTC */ /* Function: Retrieve date and time convention */ /* structures for two countries, compare an item. */ /****************************************************/ PLIQDTC: PROC OPTIONS(MAIN); %INCLUDE CEEIBMAW; /* ENTRY defs, macro defs */ %INCLUDE CEEIBMCT; /* FBCHECK macro, FB constants */ %INCLUDE CEEIBMLC; /* Locale category constants */ %INCLUDE CEEIBMDT; /* DTCONV for CEEQDTC calls */ /* use explicit pointer to local DTCONV structure */ DCL LOCALDT POINTER INIT(ADDR(DTCONV)); /* CEESETL service call arguments */ DCL LOCALE_NAME CHAR(256) VARYING; DCL 1 DTCONVC LIKE DTCONV; /* Def Second Structure */ DCL 1 FC, /* Feedback token */ 3 MsgSev REAL FIXED BINARY(15,0), 3 MsgNo REAL FIXED BINARY(15,0), 3 Flags, 5 Case BIT(2), 5 Severity BIT(3), 5 Control BIT(3), 3 FacID CHAR(3), /* Facility ID */ 3 ISI /* Instance-Specific Information */ REAL FIXED BINARY(31,0); /* set locale with IBM default for France */ LOCALE_NAME = 'FFEY'; /* or Fr_FR.IBM-1047 */ /* use LC_ALL category constant from CEEIBMLC */ CALL CEESETL ( LOCALE_NAME, LC_ALL, FC ); /* retrieve date and time structure, France Locale*/ CALL CEEQDTC ( *, LOCALDT, FC ); /* set locale with French Canadian(FCEY) defaults */ /* literal constant -1 used to set all categories */ CALL CEESETL ( 'FCEY', -1, FC ); /* retrieve date and time tables for French Canada*/ /* example of temp pointer used for service call */ CALL CEEQDTC ( *, ADDR(DTCONVC), FC ); /* compare date and time formats for two countries*/ IF DTCONVC.D_T_FMT = DTCONV.D_T_FMT THEN DO; PUT SKIP LIST('Countries have same D_T_FMT' ); END; ELSE DO; PUT SKIP LIST('Date and Time Format ', DTCONVC.D_T_FMT||' vs '|| DTCONV.D_T_FMT ); END; END PLIQDTC;