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
 

 

Validating the date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Validating the date
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

These are threads discussed recently

http://www.ibmmainframes.com/viewtopic.php?t=42794&highlight=validate+date
http://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: 186
Location: chennai

PostPosted: Thu Aug 20, 2009 4:46 pm    Post subject: Reply to: Validating the date
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Add system date inside of a PS file a... pramitdas DFSORT/ICETOOL 5 Sun Aug 28, 2016 12:06 am


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