IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Jan 27, 2009 7:10 pm
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
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: 1702
Location: Australia

PostPosted: Wed Jan 28, 2009 12:50 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top