CEEISEC—Convert integers to seconds

CEEISEC converts separate binary integers representing year, month, day, hour, minute, second, and millisecond to a number representing the number of seconds since 00:00:00 14 October 1582. Use CEEISEC instead of CEESECS when the input is in numeric format rather than character format.

The inverse of CEEISEC is CEESECI, which converts number of seconds to integer year, month, day, hour, minute, second, and millisecond.
Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEEISEC--(--input_year--,--input_months--,--input_day--,----->

>--input_hours--,--input_minutes--,--input_seconds--,----------->

>--input_milliseconds--,--output_seconds--,--fc--)-------------><

input_year (input)
A 32-bit binary integer representing the year. The valid range for input_year is 1582 to 9999, inclusive.
input_month (input)
A 32-bit binary integer representing the month. The valid range for input_month is 1 to 12.
input_day (input)
A 32-bit binary integer representing the day. The valid range for input_day is 1 to 31.
input_hours (input)
A 32-bit binary integer representing the hours. The range of valid input_hours is 0 to 23.
input_minutes (input)
A 32-bit binary integer representing the minutes. The range of valid input_minutes is 0 to 59.
input_seconds (input)
A 32-bit binary integer representing the seconds. The range of valid input_seconds is 0 to 59.
input_milliseconds (input)
A 32-bit binary integer representing milliseconds. The range of valid input_milliseconds is 0 to 999.
output_seconds (output)
A 64-bit double floating-point number representing 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). The valid range of output_seconds is 86,400 to 265,621,679,999.999 (23:59:59.999 31 December 9999). If any input values are invalid, output_seconds is set to zero. To convert output_seconds to a Lilian day number, divide output_seconds by 86,400 (the number of seconds in a day).
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.
CEE2EE 3 2510 The hours value in a call to CEEISEC or CEESECS was not recognized.
CEE2EF 3 2511 The day parameter passed in a CEEISEC call was invalid for year and month specified.
CEE2EH 3 2513 The input date passed in a CEEISEC, CEEDAYS, or CEESECS call was not within the supported range.
CEE2EI 3 2514 The year value passed in a CEEISEC call was not within the supported range.
CEE2EJ 3 2515 The milliseconds value in a CEEISEC call was not recognized.
CEE2EK 3 2516 The minutes value in a CEEISEC call was not recognized.
CEE2EL 3 2517 The month value in a CEEISEC call was not recognized.
CEE2EN 3 2519 The seconds value in a CEEISEC call was not recognized.

Usage notes

  • z/OS UNIX consideration—In multithread applications, CEEISEC affects only the calling thread.

For more information

Examples

  1. Following is an example of CEEISEC called by C/C++.
    /*Module/File Name: EDCISEC   */
    
    #include <string.h>
    #include <stdio.h>
    #include <leawi.h>
    #include <stdlib.h>
    #include <ceeedcct.h>
    
    int main(void) {
    
      _INT4 year, month, day, hours, minutes, seconds,
            millisecs;
      _FLOAT8 output;
      _FEEDBACK fc;
    
      year = 1991;
      month = 9;
      day = 13;
      hours = 4;
      minutes = 34;
      seconds = 25;
      millisecs = 746;
    
      CEEISEC(&year,&month,&day,&hours,&minutes,&seconds,;
              &millisecs,&output,&fc);
    
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
         printf("CEEISEC failed with message number %d\n",
                fc.tok_msgno);
         exit(2999);
      }
      printf("The number of seconds between 00:00:00.00"
             " 10/14/1582 and 04:34:25.746 09/13/1991"
             " is %.3f\n",output);
    }
  2. Following is an example of CEEISEC called by COBOL.
    CBL LIB,QUOTE
          *Module/File Name: IGZTISEC
          *************************************************
          **                                             **
          ** CBLISEC - Call CEEISEC to convert integers  **
          **           to seconds                        **
          **                                             **
          *************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. CBLISEC.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  YEAR                    PIC S9(9) BINARY.
           01  MONTH                   PIC S9(9) BINARY.
           01  DAYS                    PIC S9(9) BINARY.
           01  HOURS                   PIC S9(9) BINARY.
           01  MINUTES                 PIC S9(9) BINARY.
           01  SECONDS                 PIC S9(9) BINARY.
           01  MILLSEC                 PIC S9(9) BINARY.
           01  OUTSECS                 COMP-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-CBLISEC.
          *************************************************
          ** Specify seven binary integers representing  **
          ** the date and time as input to be converted  **
          ** to Lilian seconds                           **
          *************************************************
               MOVE 2000 TO YEAR.
               MOVE 1 TO MONTH.
               MOVE 1 TO DAYS.
               MOVE 0 TO HOURS.
               MOVE 0 TO MINUTES.
               MOVE 0 TO SECONDS.
               MOVE 0 TO MILLSEC.
          *************************************************
          ** Call CEEISEC to convert the integers        **
          ** to seconds                                  **
          *************************************************
               CALL "CEEISEC" USING YEAR, MONTH, DAYS,
                                    HOURS, MINUTES, SECONDS,
                                    MILLSEC, OUTSECS , FC.
    
          *************************************************
          ** If CEEISEC runs successfully, display result**
          *************************************************
               IF CEE000 of FC  THEN
                   DISPLAY MONTH "/" DAYS "/" YEAR
                       " AT " HOURS ":" MINUTES ":" SECONDS
                       " is equivalent to " OUTSECS " seconds"
               ELSE
                   DISPLAY "CEEISEC failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
    
               GOBACK.
  3. Following is an example of CEEISEC called by PL/I.
    *PROCESS MACRO;
     /*Module/File Name: IBMISEC
     /****************************************************/
     /**                                                **/
     /** Function: CEEISEC - Convert integers to        **/
     /**                     seconds                    **/
     /**                                                **/
     /** In this example, CEEISEC is called to convert  **/
     /** integers representing the date and time to the **/
     /** number of seconds since 00:00 14 October 1582. **/
     /**                                                **/
     /****************************************************/
     PLIISEC: PROC OPTIONS(MAIN);
        %INCLUDE  CEEIBMAW;
        %INCLUDE  CEEIBMCT;
    
        DCL YEAR     REAL FIXED BINARY(31,0);
        DCL MONTH    REAL FIXED BINARY(31,0);
        DCL DAYS     REAL FIXED BINARY(31,0);
        DCL HOURS    REAL FIXED BINARY(31,0);
        DCL MINUTES  REAL FIXED BINARY(31,0);
        DCL SECONDS  REAL FIXED BINARY(31,0);
        DCL MILLSEC  REAL FIXED BINARY(31,0);
        DCL OUTSECS  REAL FLOAT DECIMAL(16);
        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);
        /* Specify integers representing                 */
        /*    00:00:00 1 January 2000                    */
    
        YEAR = 2000;
        MONTH = 1;
        DAYS = 1;
        HOURS = 0;
        MINUTES = 0;
        SECONDS = 0;
        MILLSEC = 0;
       /* Call CEEISEC to convert integers to Lilian     */
       /* seconds                                        */
    
        CALL CEEISEC ( YEAR, MONTH, DAYS, HOURS,
           MINUTES, SECONDS, MILLSEC, OUTSECS, FC );
        IF  FBCHECK( FC, CEE000)  THEN  DO;
           PUT EDIT( OUTSECS, ' seconds corresponds to ',
               MONTH, '/', DAYS, '/', YEAR, ' at ', HOURS,
               ':', MINUTES, ':', SECONDS, '.', MILLSEC )
               (SKIP, F(9), A, 2 (P'99',A), P'9999', A,
               3 (P'99', A), P'999' );
           END;
        ELSE  DO;
           DISPLAY( 'CEEISEC failed with msg '
              || FC.MsgNo );
           STOP;
           END;
    
     END PLIISEC;