CEESECI: convert seconds to integers

CEESECI converts a number that represents the number of seconds since 00:00:00 14 October 1582 to binary integers that represent 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.

CALL CEESECI syntax

Read syntax diagramSkip visual syntax diagramCALL"CEESECI"USINGinput_seconds,output_year,output_month,output_day,output_hours,output_minutes,output_seconds,output_milliseconds,fc.
input_seconds
A 64-bit long floating-point number that represents 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 range of valid values 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 that represents the year.

The range of valid values for output_year is 1582 to 9999, inclusive.

output_month (output)
A 32-bit binary integer that represents the month.

The range of valid values for output_month is 1 to 12.

output_day (output)
A 32-bit binary integer that represents the day.

The range of valid values for output_day is 1 to 31.

output_hours (output)
A 32-bit binary integer that represents the hour.

The range of valid values for output_hours is 0 to 23.

output_minutes (output)
A 32-bit binary integer that represents the minutes.

The range of valid values for output_minutes is 0 to 59.

output_seconds (output)
A 32-bit binary integer that represents the seconds.

The range of valid values for output_seconds is 0 to 59.

output_milliseconds (output)
A 32-bit binary integer that represents milliseconds.

The range of valid values for output_milliseconds is 0 to 999.

fc (output)
A 12-byte feedback code (optional) that indicates the result of this service.
Table 1. CEESECI symbolic conditions
Symbolic feedback 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

  • The inverse of CEESECI is CEEISEC, which converts separate binary integers that represent year, month, day, hour, second, and millisecond to a 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.

Example


*************************************************
**                                             **
** Function: 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) COMP.
             04  Msg-No      PIC S9(4) COMP.
         03  Case-2-Condition-ID
                   REDEFINES Case-1-Condition-ID.
             04  Class-Code  PIC S9(4) COMP.
             04  Cause-Code  PIC S9(4) COMP.
         03  Case-Sev-Ctl    PIC X.
         03  Facility-ID     PIC XXX.
     02  I-S-Info            PIC S9(9) COMP.
 PROCEDURE DIVISION.
 PARA-CBLSECS.
*************************************************
** Call CEESECS to convert time stamp 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 AP'
             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.