CEESECI—Convert seconds to integers

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

The inverse of CEESECI is CEEISEC, which converts integer year, month, day, hour, second, and millisecond to number of seconds. If the input value is a Lilian date instead of seconds, multiply the Lilian date by 86,400 (number of seconds in a day), and pass the new value to CEESECI.
Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEESECI--(--input_seconds--,--output_year--,--output_month--->

>--,--output_day--,--output_hours--,--output_minutes--,--------->

>--output_seconds--,--output_milliseconds--,--fc--)------------><

input_seconds
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 for input_seconds is 86,400 to 265,621,679,999.999 (23:59:59.999 31 December 9999). If input_seconds is invalid, all output parameters except the feedback code are set to 0.
output_year (output)
A 32-bit binary integer representing the year. The range of valid output_years is 1582 to 9999, inclusive.
output_month (output)
A 32-bit binary integer representing the month. The range of valid output_months is 1 to 12.
output_day (output)
A 32-bit binary integer representing the day. The range of valid output_days is 1 to 31.
output_hours (output)
A 32-bit binary integer representing the hour. The range of valid output_hours is 0 to 23.
output_minutes (output)
A 32-bit binary integer representing the minutes. The range of valid output_minutes is 0 to 59.
output_seconds (output)
A 32-bit binary integer representing the seconds. The range of valid output_seconds is 0 to 59.
output_milliseconds (output)
A 32-bit binary integer representing milliseconds. The range of valid output_milliseconds is 0 to 999.
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.
CEE2E9 3 2505 The input_seconds value in a call to CEEDATM or CEESECI was not within the supported range.

Usage notes

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

For more information

Examples

  1. Following is an example of CEESECI called by C/C++.
    /*Module/File Name: EDCSECI   */
    
    #include <string.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <leawi.h>
    #include <ceeedcct.h>
    
    int main(void) {
    
      _INT4 year, month, day, hours, minutes, seconds,
            millisecs;
      _FLOAT8 input;
      _FEEDBACK fc;
    
      input = 13166064000.0;
      CEESECI(&input,&year,&month,&day,&hours,&minutes,;
              &seconds,&millisecs,&fc);
    
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
         printf("CEESECI failed with message number %d\n",
                fc.tok_msgno);
         exit(2999);
      }
      printf("%f seconds corresponds to the date"
             " %d:%d:%d.%d %d/%d/%d\n",input,hours,minutes,
              seconds,millisecs,month,day,year);
    }
  2. Following is an example of CEESECI called by COBOL.
    CBL LIB,QUOTE
          *Module/File Name: IGZTSECI
          *************************************************
          **                                             **
          ** CBLSECI - Call CEESECI to convert seconds   **
          **           to integers                       **
          **                                             **
          ** In this example a call is made to CEESECI   **
          ** to convert a number representing the number **
          ** of seconds since 00:00:00 14 October 1582   **
          ** to seven binary integers representing year, **
          ** month, day, hour, minute, second, and       **
          ** millisecond.  The results are displayed in  **
          ** this example.                               **
          **                                             **
          *************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. CBLSECI.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  INSECS                  COMP-2.
           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  IN-DATE.
               02  Vstring-length      PIC S9(4) BINARY.
               02  Vstring-text.
                   03  Vstring-char        PIC X,
                               OCCURS 0 TO 256 TIMES
                               DEPENDING ON Vstring-length
                                   of IN-DATE.
           01  PICSTR.
               02  Vstring-length      PIC S9(4) BINARY.
               02  Vstring-text.
                   03  Vstring-char        PIC X,
                               OCCURS 0 TO 256 TIMES
                               DEPENDING ON Vstring-length
                                  of PICSTR.
           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-CBLSECS.
          *************************************************
          ** Call CEESECS to convert timestamp of 6/2/88
          **     at 10:23:45 AM to Lilian representation
          *************************************************
               MOVE 20 TO Vstring-length of IN-DATE.
               MOVE "06/02/88 10:23:45 AM"
                       TO Vstring-text of IN-DATE.
               MOVE 20 TO Vstring-length of PICSTR.
               MOVE "MM/DD/YY HH:MI:SS AM"
                       TO Vstring-text of PICSTR.
               CALL "CEESECS" USING IN-DATE, PICSTR,
                                    INSECS, FC.
               IF NOT CEE000 of FC  THEN
                   DISPLAY "CEESECS failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
           PARA-CBLSECI.
          *************************************************
          ** Call CEESECI to convert seconds to integers
          *************************************************
               CALL "CEESECI" USING INSECS, YEAR, MONTH,
                                    DAYS, HOURS,  MINUTES,
                                    SECONDS, MILLSEC, FC.
          *************************************************
          ** If CEESECI runs successfully, display results
          *************************************************
               IF CEE000 of FC  THEN
                   DISPLAY "Input seconds of " INSECS
                       " represents:"
                   DISPLAY "   Year......... " YEAR
                   DISPLAY "   Month........ " MONTH
                   DISPLAY "   Day.......... " DAYS
                   DISPLAY "   Hour......... " HOURS
                   DISPLAY "   Minute....... " MINUTES
                   DISPLAY "   Second....... " SECONDS
                   DISPLAY "   Millisecond.. " MILLSEC
               ELSE
                   DISPLAY "CEESECI failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
    
               GOBACK.
  3. Following is an example of CEESECI called by PL/I.
    *PROCESS MACRO;
     /* Module/File Name: IBMSECI                        */
     /****************************************************/
     /**                                                 */
     /** Function: CEESECI - convert seconds to integers */
     /**                                                 */
     /****************************************************/
     PLISECI: PROC OPTIONS(MAIN);
    
        %INCLUDE  CEEIBMAW;
        %INCLUDE  CEEIBMCT;
    
        DCL INSECS   REAL FLOAT DECIMAL(16);
        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 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);
    
        INSECS = 13166064060; /* number of seconds since */
                              /* 14 October 1582         */
    
        /* Call CEESECI to convert INSECS to separate    */
        /*    binary integers representing the year,     */
        /*    month, day, hours, minutes, seconds and    */
        /*    milliseconds.                              */
        CALL CEESECI ( INSECS, YEAR, MONTH, DAYS,
           HOURS, MINUTES, SECONDS, MILLSEC, FC );
        IF  FBCHECK( FC, CEE000)  THEN  DO;
           PUT EDIT( INSECS, ' 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( 'CEESECI failed with msg '
              || FC.MsgNo );
           STOP;
           END;
    
     END PLISECI;