CEEISEC: convert integers to seconds

CEEISEC converts binary integers that represent year, month, day, hour, minute, second, and millisecond to a number that represents the number of seconds since 00:00:00 14 October 1582.

CALL CEEISEC syntax

Read syntax diagramSkip visual syntax diagramCALL"CEEISEC"USINGinput_year,input_months,input_day,input_hours,input_minutes,input_seconds,input_milliseconds,output_seconds,fc.

input_year (input)
A 32-bit binary integer that represents the year.

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

input_month (input)
A 32-bit binary integer that represents the month.

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

input_day (input)
A 32-bit binary integer that represents the day.

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

input_hours (input)
A 32-bit binary integer that represents the hours.

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

input_minutes (input)
A 32-bit binary integer that represents the minutes.

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

input_seconds (input)
A 32-bit binary integer that represents the seconds.

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

input_milliseconds (input)
A 32-bit binary integer that represents milliseconds.

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

output_seconds (output)
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 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) that indicates the result of this service.

Table 1. CEEISEC symbolic conditions
Symbolic feedback 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 note: The inverse of CEEISEC is CEESECI, which converts number of seconds to integer year, month, day, hour, minute, second, and millisecond.

Example


*************************************************
**                                             **
** Function: 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) 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-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.