Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need db2 query to match time stamp field thru JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Wed May 28, 2008 8:12 pm    Post subject: Need db2 query to match time stamp field thru JCL
Reply with quote

Hi,

I have to write one SQL query to delete some records based on below condition

I have to check the date field in the table which contains time stamp also but i have to match that field to current date if the date(time stamp) in table is lesser than 6 months i have to delete the record from table. This requirement has to achieve thru JCL only.

Thanks in advance.

Harsha.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed May 28, 2008 8:47 pm    Post subject:
Reply with quote

You can not do it just using JCL!

If you are sure you want to delete rows that are less than 6 months old then this sql statement will do it
DELETE FROM TABLE WHERE CURRENT TIMESTAMP - DATE_COL < 600000000;

For more than 6 months old change the < to >.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu May 29, 2008 7:09 pm    Post subject:
Reply with quote

DB2 date functions should let you do this for more readability

WHERE DATE_COL < CURRENT TIMESTAMP - 6 MONTHS
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 query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Native SQL Query kishpra DB2 1 Wed Nov 22, 2017 8:38 pm
No new posts Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am
No new posts Query on IEFBR14 with GDG Ashishpanpaliya JCL & VSAM 4 Tue Nov 07, 2017 8:34 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us