View previous topic :: View next topic
|
Author |
Message |
abdulrafi
Active User
Joined: 14 Sep 2009 Posts: 184 Location: Coimbatore
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
wherre are you getting this timestamp from DB2..???? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Yup, that will be ok if the code already uses DB2 . . .
d |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Bill,
I believe the TS wants to validate a timestamp that has arrived in the code . . . |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Dick,
Sorry, blew right through that post's aspect |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Negative perspiration
Do that myself with some regularity
d |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
|