MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need utility to change dates in a file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
arunkumar_e
Beginner


Joined: 06 May 2004
Posts: 27
Topics: 16
Location: Bangalore

PostPosted: Wed Mar 30, 2005 11:58 pm    Post subject: Need utility to change dates in a file Reply with quote

Hi
I have a file say FILE1 where in i have 2 dates say STARTDATE and ENDDATE.
Suppose i change the dates this saturday , it wud be like
'04022004 04022005'
Suppose i change the dates next saturday , it wud be like
'04092004 04092005'
and so on.
I also have a query in a PDS which uses these STARTDATE and ENDDATE to extract the data from tables.Now every week i change these
DATES in the FILE1 and run the querry.
Now i want to automate this process. say i want a utility which wud convert the STARTDATE and ENDDATE. Also i want to run the utility
every week end say every saturday.
The STARTDATE and ENDDATE are of the format MMDDYYYY.

can any one help me out in this

Thanks
Arun
_________________
Arun
"Genius is one percent inspiration and ninety-nine percent perspiration." -- Thomas A. Edison
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Mar 31, 2005 6:39 am    Post subject: Reply with quote

arunkumar_e,

try this sql. This will bring the saturday's date of this year as start date and adds 1 year to it as end date.

Code:

SELECT SUBSTR(CHAR(NEXT_DAY(CURRENT DATE,'SAT')),6,2)                 
       CONCAT                                                         
       SUBSTR(CHAR(NEXT_DAY(CURRENT DATE,'SAT')),9,2)                 
       CONCAT                                                         
       SUBSTR(CHAR(NEXT_DAY(CURRENT DATE,'SAT')),1,4)                 
      ,SUBSTR(CHAR(DATE(NEXT_DAY(CURRENT DATE,'SAT')) + 1 YEAR),6,2) 
       CONCAT                                                         
       SUBSTR(CHAR(DATE(NEXT_DAY(CURRENT DATE,'SAT')) + 1 YEAR),9,2) 
       CONCAT                                                         
       SUBSTR(CHAR(DATE(NEXT_DAY(CURRENT DATE,'SAT')) + 1 YEAR),1,4) 
 FROM SYSIBM.SYSDUMMY1                                               
;


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group