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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts Regarding time parameter shanthi gude JCL & VSAM 7 Mon Sep 04, 2017 2:31 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am

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