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
 

 

How to get last saturday date by using control-m varables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
pradeepkumarrk

New User


Joined: 17 Oct 2005
Posts: 2

PostPosted: Tue Jan 27, 2009 6:57 pm    Post subject: How to get last saturday date by using control-m varables
Reply with quote

How to get the last saturday date in the job by using control-m variables. Irrespective of the day job runs.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 27, 2009 7:10 pm    Post subject:
Reply with quote

Recently asked.

Look HERE
Back to top
View user's profile Send private message
pradeepkumarrk

New User


Joined: 17 Oct 2005
Posts: 2

PostPosted: Wed Jan 28, 2009 11:11 am    Post subject: Reply to: How to get last saturday date by using control-m v
Reply with quote

Expat,

I ran the job with the data mentioned in the topic.
Job is setting up LASTSAT DATE as 22-JAN-09 which is wrong. It has to set last saturday as 24-jan-09.
Code:

//*     %%SET %%CURRENT = %%SUBSTR %%DATE 1 1             
//*     %%IF   %%CURRENT EQ 9                               
//*     %%SET %%CENT = 19                               
//*     %%ELSE                                       
//*     %%SET %%CENT = 20                               
//*     %%ENDIF                                         
//*     %%SET %%DX1 = %%CALCDATE %%ODATE -6               
//*     %%SET %%DM1 = %%SUBSTR %%DX1 3 2                   
//*     %%SET %%DD1 = %%SUBSTR %%DX1 5 2                   
//*     %%SET %%DY1 = %%SUBSTR %%DX1 1 2                   
//*     %%SET %%LASTSAT = %%DY1%%.%%DM1%%.%%DD1           
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Jan 28, 2009 12:50 pm    Post subject:
Reply with quote

Hi,

the above code will only work when the job is scheduled with Friday's ODATE.


You can try this
Code:
//*      %%IF %%OWDAY EQ 1                                       
//*           %%SET %%OPRV_SAT     = %%CALCDATE %%ODATE -1       
//*      %%ENDIF                                                 
//*      %%IF %%OWDAY EQ 2                                       
//*           %%SET %%OPRV_SAT     = %%CALCDATE %%ODATE -2       
//*      %%ENDIF                                                 
//*      %%IF %%OWDAY EQ 3                                       
//*           %%SET %%OPRV_SAT     = %%CALCDATE %%ODATE -3       
//*      %%ENDIF                                                 
//*      %%IF %%OWDAY EQ 4                                       
//*           %%SET %%OPRV_SAT     = %%CALCDATE %%ODATE -4       
//*      %%ENDIF                                                 
//*      %%IF %%OWDAY EQ 5                                       
//*           %%SET %%OPRV_SAT     = %%CALCDATE %%ODATE -5       
//*      %%ENDIF                                                 
//*      %%IF %%OWDAY EQ 6                                       
//*           %%SET %%OPRV_SAT     = %%CALCDATE %%ODATE -6       
//*      %%ENDIF                                                 
//*      %%IF %%OWDAY EQ 0                                 
//*           %%SET %%OPRV_SAT     = %%CALCDATE %%ODATE -7 
//*      %%ENDIF                                           


Please note that 1 is used for Sunday, 2 is for Monday and so on in my shop.


Gerry
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am


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