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

Valid timestamp format


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

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Thu May 30, 2013 9:34 pm
Reply with quote

Hi,

I would need a help on to identify if a field contains a valid timestamp format or not.

I do have a requirement where I get a timestamp value in a variable and I need to check if its in the correct format or not.

The actual timestamp format is fo 26 bytes: yyyy-MM-dd-HH.mm.ss.ffffff

Should I check if there is a '-' on 5th,8th,11th position and '.' in 14th,17th,20th position ?. Will it be the correct way to check it ??

Please advice.

Thanks
Abdul Rafi
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 30, 2013 9:42 pm
Reply with quote

Hello,

To be accurate/complete, you must test every part of the entire field. Merely checking the "-" and "." delimiters provides little value. . .

What about a month, day, hour, minute, second that are numeric, but invalid?

Same with year, and leap year.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Thu May 30, 2013 9:46 pm
Reply with quote

wherre are you getting this timestamp from DB2..????
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu May 30, 2013 9:59 pm
Reply with quote

Try to do a SET or SELECT FROM SYSDUMMY1 using the value you have

So you dont need to bother about source information
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 30, 2013 10:02 pm
Reply with quote

Yup, that will be ok if the code already uses DB2 . . .

d
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: Thu May 30, 2013 11:07 pm
Reply with quote

The following previous post, shows the use of the Assembler TIME macro, returning a date-format of C'CCYYMMDD' and a time-format of C'HHMMSSTHMIJU', with "U" representing microseconds. If you don't have DB2, then this should suffice -

ibmmainframes.com/viewtopic.php?p=310291&highlight=#310291
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 30, 2013 11:29 pm
Reply with quote

Hi Bill,

I believe the TS wants to validate a timestamp that has arrived in the code . . . icon_cool.gif
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: Thu May 30, 2013 11:56 pm
Reply with quote

Dick,

Sorry, blew right through that post's aspect icon_rolleyes.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 31, 2013 1:04 am
Reply with quote

Negative perspiration icon_smile.gif

Do that myself with some regularity icon_redface.gif

d
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: Fri May 31, 2013 2:37 am
Reply with quote

You can verify the format as well as the contents by calling LE Callable Service routine "CEESECS".

pic.dhe.ibm.com/infocenter/ratdevz/v7r5/index.jsp?topic=%2Fcom.ibm.etools.cbl.win.doc%2Ftopics%2Frpsrv36.htm

A value returned by "CEESECS", in the first two-bytes of the 12-byte "Feedback Code" parameter, which is not X'00's should be considered an error.

HTH....
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts InfoSphere OPTIM CSV ouput vs DSNTIUA... IBM Tools 3
Search our Forums:

Back to Top