IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Date Time in Cobol Enterprise using LE CEESECS service


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ermy

New User


Joined: 13 Mar 2010
Posts: 6
Location: ITALY

PostPosted: Wed Nov 17, 2010 4:59 pm
Reply with quote

I would check in COBOL the formal validity of a date. The LE CEESECS function seems to be suitable for this task. I tried to use it but doesn't seem to regard the date separator (if it is wrong o right) . Look at this. If you specify the date format
11/11/2010 22:11:59.900 with pic-string YYYY-MM-DD HH: MI: SS.999 everything is ok, the return value is (.13508892719900000 E 11) . But even if you use this wrong date format
2010-11*11 22:11:59.900 with pic-string YYYY-MM-DD HH: MI: SS.999 ("*" to separate month / day) also works correctly, CEESECS then converts into seconds (.13508892719900000 E 11). In this latter case CEESECS should return error 2525 (CEESECS detected non-numeric data in a numeric field, or the timestamp string did not match the picture string. )
Is there a mistake? icon_eek.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 17, 2010 5:16 pm
Reply with quote

I suspect that the * is considered a valid delimiter, hence there's no error.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 17, 2010 5:21 pm
Reply with quote

Review CEELOCT, which returns the current date/time as a format of CCYYMMDDHHMMSS999, along with a variety of picture clauses.

If you also need the GMT Offset-to-Local as a signed HHMM, review CEEGMTO.

However, COBOL FUNCTION CURRENT-DATE (introduced with COBOL/370) returns a value of CCYYMMDDHHMMSSTH+/-HHMM, combining both above values, except milliseconds in the time.

If you only need to check the validity of an existing date, review CEEDAYS.

Bill
Back to top
View user's profile Send private message
Ermy

New User


Joined: 13 Mar 2010
Posts: 6
Location: ITALY

PostPosted: Wed Nov 17, 2010 6:39 pm
Reply with quote

Robert Sample wrote:
I suspect that the * is considered a valid delimiter, hence there's no error.


Any symbol is accepted! Not only 'star' "*"!
2010é11é11 22:11:59.900 with a pic-string "YYYY-MM-DD HH: MI: SS.999" CEESEECS gives correctly .13508892719900000 E 11 seconds !
"è" should not be a valid separator , I hope !
Back to top
View user's profile Send private message
Ermy

New User


Joined: 13 Mar 2010
Posts: 6
Location: ITALY

PostPosted: Wed Nov 17, 2010 6:53 pm
Reply with quote

Bill O'Boyle wrote:
Review CEELOCT, which returns the current date/time as a format of CCYYMMDDHHMMSS999, along with a variety of picture clauses.

If you also need the GMT Offset-to-Local as a signed HHMM, review CEEGMTO.

However, COBOL FUNCTION CURRENT-DATE (introduced with COBOL/370) returns a value of CCYYMMDDHHMMSSTH+/-HHMM, combining both above values, except milliseconds in the time.

If you only need to check the validity of an existing date, review CEEDAYS.

Bill


CEEDAYS suffers the same problem of CEESECS,
Any character is accepted as a date separator, but that is expected , see the LE Programming Reference ("Whenever characters such as colons or slashes are included in the picture_string (such as HH:MI:SS YY/MM/DD), they count as placeholders but are otherwise ignored. " )
For CEESECS is different, as stated in LE Programming Reference, " A length-prefixed character string representing a date or timestamp in a format matching that specified by picture_string..... After a valid date is parsed, as determined by the format of the date you specify in picture_string, ....".
Pic-string seems to be ( or must be ) a model for date ! If date doesn't respect <pic-string> format, CEESECS should return a error. Any idea about ?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 17, 2010 7:34 pm
Reply with quote

When I've used CEEDAYS, the picture clause never includes any edit characters, it's just YYYYMMDD or YYYYDDD or a variety of other formats without edit characters. Keep in mind that the picture clause length is 1-Byte Binary/Hex. (See correction below)

If all you're doing is validating the date via CEEDAYS and the date is correct, then the first 2-Bytes of the feedback-area (4th-parm) will equal X'00's, upon return.

Validating the time is easy enough to do programmatically and I won't get into that.

In fact, you should only call CEEDAYS after performing your own programmatic tests, which are also easy enough to do.

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Nov 22, 2010 2:16 am
Reply with quote

Quote:
Keep in mind that the picture clause length is 1-Byte Binary/Hex.

A correction. The length is a binary-halfword.

Bill
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top