Get current TIMESTAMP using CEELOCT

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
Read syntax diagramSkip visual syntax diagram>>-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. The following Feedback Code 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.

The following is a sample snippet of code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
      *
      * Author: Santix, http://www.italianscool.com
      *  
      * Get current TIMESTAMP using CEELOCT 
      * 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. CBLDATE.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 LILIAN PIC S9(9) COMP.
       01 XSECONDS PIC S9(18) COMP.
       01 GREGORN PIC X(17).
       01 FC.
         03 CEEIGZCT-RC PIC X.
           88 CEE000 VALUE LOW-VALUE.
         03 FILLER PIC X(11).
      *
       PROCEDURE DIVISION.
       MAIN-SECTION.
           CALL 'CEELOCT' USING LILIAN
                                XSECONDS
                                GREGORN
                                FC
           IF CEE000 OF FC
             DISPLAY 'Local Time is ' GREGORN
           ELSE
             DISPLAY 'CEELOCT error' UPON CONSOLE
           END-IF
           GOBACK.

Execution output:

Local Time is 20141013150804732

 

For more information: pic.dhe.ibm.com/infocenter