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 

determine Monday and subtract 3 days from current date ?

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Sat May 05, 2007 6:04 am    Post subject: determine Monday and subtract 3 days from current date ? Reply with quote

I'm trying to set up an automated query that runs every morning, but it needs to check the prior day's date, so I did the following:

Code:
AND E.DATE_PROCESSED = (CURRENT DATE - 1 DAY)


This will work fine, except that Friday's report doesn't run until Monday morning, so I need to subtract 3 days if the report is being run on Monday, instead of 1 day.

Can anyone help out with this ?

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sat May 05, 2007 9:33 am    Post subject: Reply with quote

tcurrier,

Try this untested query. You can run it on any day and it will still give you the results for a business day (mon-fri)

Code:
 
AND E.DATE_PROCESSED = (CURRENT DATE - (CASE DAYOFWEEK(CURRENT DATE)
                                             WHEN 1 THEN  INT(2)   
                                             WHEN 2 THEN  INT(3)   
                                             ELSE INT(1) END) DAYS)


Dayofweek scalar function is explained here

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.20?SHELF=&DT=20010718164132&CASE=

Hope this helps...

Cheers

Kolusu


Ps: I am hoping that this question is not posted else where. If it is posted else where then you will loose the privileges to post on this board as this is not the first time you did that. Pick a board of your choice, it does not matter which one it is and wait for a min of 8 hours to post it on another helpboard. your prior question of lpar was deleted for the same reason.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Sat May 05, 2007 12:52 pm    Post subject: Reply with quote

It works perfect.... Thank you very much ...

And thanks for the P.S. about posting in two different forums.... I don't post very often, so I wasn't sure if that was allowed or not.... But thanks for clearing it up...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database 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