CEEDATE converts a number that represents a Lilian date to a date written in character format. The output is a character string, such as 2008/04/23.
| CALL CEEDATE syntax |
|---|
|
If picture_string includes a Japanese Era symbol <JJJJ>, the YY position in output_char_date is replaced by the year number within the Japanese Era. For example, the year 1988 equals the Japanese year 63 in the Showa era.
| Symbolic feedback code | Severity | Message number | Message text |
|---|---|---|---|
| CEE000 | 0 | — | The service completed successfully. |
| CEE2EG | 3 | 2512 | The Lilian date value passed in a call to CEEDATE or CEEDYWK was not within the supported range. |
| CEE2EM | 3 | 2518 | An invalid picture string was specified in a call to a date/time service. |
| CEE2EQ | 3 | 2522 | An era (<JJJJ>, <CCCC>, or <CCCCCCCC>) was used in a picture string passed to CEEDATE, but the Lilian date value was not within the supported range. The era could not be determined. |
| CEE2EU | 2 | 2526 | The date string returned by CEEDATE 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 CEEDATE is CEEDAYS, which converts character dates to the Lilian format.
CBL LIB
************************************************
** **
** Function: CEEDATE - convert Lilian date to **
** character format **
** **
** In this example, a call is made to CEEDATE **
** to convert a Lilian date (the number of **
** days since 14 October 1582) to a character **
** format (such as 6/22/98). The result is **
** displayed. The Lilian date is obtained **
** via a call to CEEDAYS. **
** **
************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLDATE.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LILIAN PIC S9(9) BINARY.
01 CHRDATE PIC X(80).
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-CBLDAYS.
*************************************************
** Call CEEDAYS to convert date of 6/2/98 to **
** Lilian representation **
*************************************************
MOVE 6 TO Vstring-length of IN-DATE.
MOVE '6/2/98' TO Vstring-text of IN-DATE(1:6).
MOVE 8 TO Vstring-length of PICSTR.
MOVE 'MM/DD/YY' TO Vstring-text of PICSTR(1:8).
CALL 'CEEDAYS' USING IN-DATE, PICSTR,
LILIAN, FC.
*************************************************
** If CEEDAYS runs successfully, display result**
*************************************************
IF CEE000 of FC THEN
DISPLAY Vstring-text of IN-DATE
' is Lilian day: ' LILIAN
ELSE
DISPLAY 'CEEDAYS failed with msg '
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
*************************************************
** Specify picture string that describes the **
** desired format of the output from CEEDATE, **
** and the picture string's length. **
*************************************************
MOVE 23 TO Vstring-length OF PICSTR.
MOVE 'ZD Mmmmmmmmmmmmmmz YYYY' TO
Vstring-text OF PICSTR(1:23).
*************************************************
** Call CEEDATE to convert the Lilian date **
** to a picture string. **
*************************************************
CALL 'CEEDATE' USING LILIAN, PICSTR,
CHRDATE, FC.
*************************************************
** If CEEDATE runs successfully, display result**
*************************************************
IF CEE000 of FC THEN
DISPLAY 'Input Lilian date of ' LILIAN
' corresponds to: ' CHRDATE
ELSE
DISPLAY 'CEEDATE failed with msg '
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
GOBACK.
The following table shows the sample output from CEEDATE.
| input_Lilian_date | picture_string | output_char_date |
|---|---|---|
| 148138 | YY
YYMM YY-MM YYMMDD YYYYMMDD YYYY-MM-DD YYYY-ZM-ZD <JJJJ> YY.MM.DD |
98
9805 98-05 980516 19980516 1998-05-16 1998-5-16 Showa 63.05.16 (in a DBCS string) |
| 148139 | MM
MMDD MM/DD MMDDYY MM/DD/YYYY ZM/DD/YYYY |
05
0517 05/17 051798 05/17/1998 5/17/1998 |
| 148140 | DD
DDMM DDMMYY DD.MM.YY DD.MM.YYYY DD Mmm YYYY |
18
1805 180598 18.05.98 18.05.1998 18 May 1998 |
| 148141 | DDD
YYDDD YY.DDD YYYY.DDD |
140
98140 98.140 1998.140 |
| 148142 | YY/MM/DD HH:MI:SS.99
YYYY/ZM/ZD ZH:MI AP |
98/05/20 00:00:00.00
1998/5/20 0:00 AM |
| 148143 | WWW., MMM DD, YYYY
Www., Mmm DD, YYYY
Wwwwwwwwww, Mmmmmmmmmm DD, YYYY
Wwwwwwwwwz, Mmmmmmmmmz DD, YYYY |
SAT., MAY 21, 1998
Sat., May 21, 1998
Saturday, May 21, 1998
Saturday, May 21, 1998 |
Example: date-and-time picture strings
related references
Picture character terms and strings