CEEDATM converts a number that represents the number of seconds since 00:00:00 14 October 1582 to a character string. The output is a character string timestamp such as 1988/07/26 20:37:00.
| CALL CEEDATM syntax |
|---|
|
For example, 00:00:01 on 15 October 1582 is second number 86,401 (24*60*60 + 01). The valid range of input_seconds is 86,400 to 265,621,679,999.999 (23:59:59.999 31 December 9999).
Each character in the picture_string represents a character in output_timestamp. If delimiters such as a slash (/) appear in the picture string, they are copied as is to output_timestamp.
If picture_string includes the Japanese Era symbol <JJJJ>, the YY position in output_timestamp represents the year within Japanese Era.
If necessary, the output is truncated to the length of output_timestamp.
If input_seconds is invalid, output_timestamp is set to all blanks and CEEDATM terminates with a non-CEE000 symbolic feedback code.
| 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. |
| CEE2EA | 3 | 2506 | An era (<JJJJ>, <CCCC>, or <CCCCCCCC>) was used in a picture string passed to CEEDATM, but the input number-of-seconds value was not within the supported range. The era could not be determined. |
| CEE2EM | 3 | 2518 | An invalid picture string was specified in a call to a date or time service. |
| CEE2EV | 2 | 2527 | The timestamp string returned by CEEDATM was truncated. |
| CEE2F6 | 1 | 2534 | Insufficient field width was specified for a month or weekday name in a call to CEEDATE or CEEDATM. Output set to blanks. |
Usage note: The inverse of CEEDATM is CEESECS, which converts a timestamp to number of seconds.
CBL LIB
*************************************************
** **
** Function: CEEDATM - convert seconds to **
** character timestamp **
** **
** In this example, a call is made to CEEDATM **
** to convert a date represented in Lilian **
** seconds (the number of seconds since **
** 00:00:00 14 October 1582) to a character **
** format (such as 06/02/88 10:23:45). The **
** result is displayed. **
** **
*************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLDATM.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DEST PIC S9(9) BINARY VALUE 2.
01 SECONDS COMP-2.
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 TIMESTP PIC X(80).
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-CBLDATM.
*************************************************
** 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 AP'
TO Vstring-text of PICSTR.
CALL 'CEESECS' USING IN-DATE, PICSTR,
SECONDS, FC.
*************************************************
** If CEESECS runs successfully, display result**
*************************************************
IF CEE000 of FC THEN
DISPLAY Vstring-text of IN-DATE
' is Lilian second: ' SECONDS
ELSE
DISPLAY 'CEESECS failed with msg '
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
*************************************************
** Specify desired format of the output. **
*************************************************
MOVE 35 TO Vstring-length OF PICSTR.
MOVE 'ZD Mmmmmmmmmmmmmmz YYYY at HH:MI:SS'
TO Vstring-text OF PICSTR.
*************************************************
** Call CEEDATM to convert Lilian seconds to **
** a character timestamp **
*************************************************
CALL 'CEEDATM' USING SECONDS, PICSTR,
TIMESTP, FC.
*************************************************
** If CEEDATM runs successfully, display result**
*************************************************
IF CEE000 of FC THEN
DISPLAY 'Input seconds of ' SECONDS
' corresponds to: ' TIMESTP
ELSE
DISPLAY 'CEEDATM failed with msg '
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
GOBACK.
The following table shows the sample output of CEEDATM.
| input_seconds | picture_string | output_timestamp |
|---|---|---|
| 12,799,191,601.000 | YYMMDD
HH:MI:SS YY-MM-DD YYMMDDHHMISS YY-MM-DD HH:MI:SS
YYYY-MM-DD HH:MI:SS AP |
880516
19:00:01 88-05-16 880516190001 88-05-16 19:00:01
1988-05-16 07:00:01 PM |
| 12,799,191,661.986 | DD Mmm YY
DD MMM YY HH:MM
WWW, MMM DD, YYYY ZH:MI AP
Wwwwwwwwwz, ZM/ZD/YY HH:MI:SS.99 |
16 May 88
16 MAY 88 19:01
MON, MAY 16, 1988 7:01 PM
Monday, 5/16/88 19:01:01.98 |
| 12,799,191,662.009 | YYYY
YY Y MM ZM RRRR MMM Mmm Mmmmmmmmmm Mmmmmmmmmz DD ZD DDD HH ZH MI SS 99 999 AP WWW Www Wwwwwwwwww Wwwwwwwwwz |
1988
88 8 05 5 V MAY May May May 16 16 137 19 19 01 02 00 009 PM MON Mon Monday Monday |
Example: date-and-time picture strings
related references
Picture character terms and strings