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
 

 

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 DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts Application not run by time HH:MM tri... jzhardy IBM Tools 1 Sun Apr 09, 2017 3:22 pm


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