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

Validating the date


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sriram K

New User


Joined: 17 Feb 2009
Posts: 32
Location: Bangalore

PostPosted: Thu Aug 20, 2009 11:54 am
Reply with quote

Hi,

I want to validate whether the incoming date is valid or not for that i m using the below query


EXEC SQL
SELECT DATE(:WS-CHECK-DATE)
INTO :WS-TEST-DATE
FROM SYSIBM.SYSDUMMY1
END-EXEC

Is ther any other way to check the date instead of using SYSIBM.SYSDUMMY1 . Will it affect the performance if we use execute this for each record.
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Thu Aug 20, 2009 11:58 am
Reply with quote

You can check for the return code -180 and -181 to check weather the date format and the date value is porper or not.
Back to top
View user's profile Send private message
Sriram K

New User


Joined: 17 Feb 2009
Posts: 32
Location: Bangalore

PostPosted: Thu Aug 20, 2009 12:03 pm
Reply with quote

But many progarms do check for the below query often

EXEC SQL
SELECT DATE(:WS-CHECK-DATE)
INTO :WS-TEST-DATE
FROM SYSIBM.SYSDUMMY1
END-EXEC

Any idea when we should go for this. Any other way to check for valid date instead of checking the bad return code
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Thu Aug 20, 2009 12:18 pm
Reply with quote

Do it programmatically ..
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 20, 2009 12:35 pm
Reply with quote

These are threads discussed recently

www.ibmmainframes.com/viewtopic.php?t=42794&highlight=validate+date
www.ibmmainframes.com/viewtopic.php?p=192595&highlight=#192595
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Thu Aug 20, 2009 4:46 pm
Reply with quote

Hi Sriram

What you have coded is correct. But here also you have to check for the bad SQLCODE (-181, -180). You can also use programming technique instead of using SQL to check the validity of the date value.

Regards
Raghu
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 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 Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top