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: 193
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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts Need help in reading and validating a... ABINAYATHULASI COBOL Programming 8 Tue Apr 18, 2017 11:42 am
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am


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