|
CEELOCT
returns the current local date or time in three formats: - Lilian date (the number of days since 14 October 1582)
- Lilian seconds (the number of seconds since 00:00:00 14 October
1582)
- Gregorian character string (in the form YYYYMMDDHHMISS999)
These values are compatible with other Language Environment date
and time services, and with existing language intrinsic functions.
CEELOCT
performs the same function as calling the CEEGMT, CEEGMTO, and CEEDATM
date and time services separately. CEELOCT,
however, performs the same services with much greater speed.
The
character value returned by CEELOCT is designed to match that produced
by existing language intrinsic functions. The numeric values returned
can be used to simplify date calculations.
Syntax
>>-CEELOCT--(--output_Lilian--,--output_seconds--,-------------->
>--output_Gregorian--,--fc--)----------------------------------><
- output_Lilian (output)
- A 32-bit binary integer representing the current local date in
the Lilian format, that is, day 1 equals 15 October 1582, day 148,887
equals 4 June 1990. If the local time is not available from the system, output_Lilian is
set to 0 and CEELOCT terminates with a non-CEE000 symbolic feedback
code.
- output_seconds (output)
- A 64-bit double-floating point number representing the current
local date and time as the number of seconds since 00:00:00 on 14
October 1582, not counting leap seconds. For example, 00:00:01 on
15 October 1582 is second number 86,401 (24*60*60 + 01). 19:00:01.078
on 4 June 1990 is second number 12,863,905,201.078. If the local time
is not available from the system, output_seconds is
set to 0 and CEELOCT terminates with a non-CEE000 symbolic feedback
code.
- output_Gregorian (output)
- A 17-byte fixed-length character string in the form YYYYMMDDHHMISS999
representing local year, month, day, hour, minute, second, and millisecond.
If the format of output_Gregorian does not
meet your needs, you can use the
CEEDATM callable service to convert output_seconds to
another format.
- 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. |
CEE2F3 |
3 |
2531 |
The local time was not available from the system. |
Usage notes - z/OS consideration—The MVS™ command SET DATE will not affect
the value returned by CEELOCT.
- CICS® consideration—CEELOCT
does not use the OS TIME macro.
- z/OS UNIX consideration—In
multithread applications, CEELOCT affects only the calling thread.
Examples - Following is an example of CEELOCT called by C/C++.
/*Module/File Name: EDCLOCT */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <leawi.h>
#include <ceeedcct.h>
int main(void) {
_FEEDBACK fc;
_INT4 lil_date;
_FLOAT8 local_date;
_CHAR17 gregorian_date;
CEELOCT(&lil_date,&local_date,gregorian_date,&fc);
if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
printf("CEELOCT failed with message number %d\n",
fc.tok_msgno);
exit(2999);
}
printf("The current date is YYYYMMDDHHMISS999\n");
printf(" %.17s\n",gregorian_date);
}
- Following is an example of CEELOCT called by COBOL.
CBL LIB,QUOTE
*Module/File Name: IGZTLOCT
************************************************
** **
** CBLLOCT - Call CEELOCT to get current **
** local time **
** **
** In this example, a call is made to CEELOCT **
** to return the current local time in Lilian **
** days (the number of days since 14 October **
** 1582), Lilian seconds (the number of **
** seconds since 00:00:00 14 October 1582), **
** and a Gregorian string (in the form **
** YYYMMDDMISS999). The Gregorian character **
** string is then displayed. **
** **
************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLLOCT.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LILIAN PIC S9(9) BINARY.
01 SECONDS COMP-2.
01 GREGORN PIC X(17).
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-CBLLOCT.
CALL "CEELOCT" USING LILIAN, SECONDS,
GREGORN, FC.
************************************************
** If CEELOCT runs successfully, display **
** Gregorian character string **
************************************************
IF CEE000 of FC THEN
DISPLAY "Local Time is " GREGORN
ELSE
DISPLAY "CEELOCT failed with msg "
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
GOBACK.
- Following is an example of CEELOCT called by PL/I.
*PROCESS MACRO;
/* Module/File Name: IBMLOCT */
/****************************************************/
/** **/
/** Function: CEELOCT - get current local time **/
/** **/
/** In this example, CEELOCT is called to return **/
/** the current local time as a Lilian date, **/
/** Lilian timestamp, and Gregorian character **/
/** string. **/
/** **/
/****************************************************/
PLILOCT: PROC OPTIONS(MAIN);
%INCLUDE CEEIBMAW;
%INCLUDE CEEIBMCT;
DCL LILIAN REAL FIXED BINARY(31,0);
DCL SECONDS REAL FLOAT DECIMAL(16);
DCL GREGORN CHARACTER ( 17 );
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);
/* Call CEELOCT to return local time in 3 formats */
CALL CEELOCT ( LILIAN, SECONDS, GREGORN, FC );
/* If CEELOCT ran successfully, print Gregorian */
/* result */
IF FBCHECK( FC, CEE000) THEN DO;
PUT SKIP LIST( 'The local date and time are '
|| GREGORN || '.' );
END;
ELSE DO;
DISPLAY( 'CEELOCT failed with msg '
|| FC.MsgNo );
STOP;
END;
END PLILOCT;
|