Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Date Time in Cobol Enterprise using LE CEESECS service

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Ermy

New User


Joined: 13 Mar 2010
Posts: 5
Location: ITALY

PostPosted: Wed Nov 17, 2010 4:59 pm    Post subject: Date Time in Cobol Enterprise using LE CEESECS service
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Wed Nov 17, 2010 5:16 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 17, 2010 5:21 pm    Post subject: Reply to: Date Time in Cobol Enterprise using LE CEESECS ser
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: 5
Location: ITALY

PostPosted: Wed Nov 17, 2010 6:39 pm    Post subject:
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: 5
Location: ITALY

PostPosted: Wed Nov 17, 2010 6:53 pm    Post subject: Re: Reply to: Date Time in Cobol Enterprise using LE CEESECS
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Nov 17, 2010 7:34 pm    Post subject: Reply to: Date Time in Cobol Enterprise using LE CEESECS ser
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Nov 22, 2010 2:16 am    Post subject: Reply to: Date Time in Cobol Enterprise using LE CEESECS ser
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us