It is currently 20 Jul 2017 10:41


Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 29 Nov 2012 7:07 
Offline
Nouveau
Nouveau
User avatar

Joined: 19 Mar 2009 9:00
Posts: 148
Location: Delhi
Dear team,

I am trying to pass the date variable to my Control-M jobs, where i need to pass first day of the last month and last day of the last month in the job command line in format MMDDYYYY

this job will be running on Ad-hoc basis and doesnot have any defined scheduling date.

Please let me know if there is any way to perform above action in Control-M Job definition using auto edit variable or any other variable usage.

Regards.
Rahul Sehgal


Top
   
 Post subject:
PostPosted: 30 Nov 2012 6:44 
Offline
Nouveau
Nouveau
User avatar

Joined: 08 Jun 2007 8:00
Posts: 807
Location: Varese - Italy
Yes you can do that, is a usual need.
You may use the %%CALCDATE function and the %%SUBSTR function.
The calculation are based on the %%ODATE or %%$ODATE variable.

I write here the sintax of functions, so you can try to solve the problem; then we can compare the solutions: ok ?

Calcdate
result=%%CALCDATE date +|-quantity
Example:
%%A=%%CALCDATE %%DATE -2

substr
result=%%SUBSTR variable startpos length

Example:
%%Number=%%SUBSTR %%Nstring %%Start 3
if Nstring=123456789 and start=3 lenght=4
Number=4567

(from Parameter Guide pag. 520-521)

Regards


Top
   
 Post subject:
PostPosted: 03 Dec 2012 6:33 
Offline
Nouveau
Nouveau
User avatar

Joined: 08 Jun 2007 8:00
Posts: 807
Location: Varese - Italy
Yere one solution in the date format YYYYmmDD:

in set panel:
data1=%%$CALCDATE %%$OYEAR.%%OMONTH.01 +32
data2=%%$CALCDATE %%$OYEAR.%%OMONTH.01 +62
sub1=%%SUBSTR %%data1 1 6
sub2=%%SUBSTR %%data2 1 6
LastDay=%%$CALCDATE %%sub2.01 -1
FirstDay=%%sub1.01


The echo of variables calculated as above (job ordered on today date 20121203) is:
LastDay=20130131 FirstDay=20130101

The calcdate are done considering that must be valid all month, even for february.
You can change the data format using the SUBSTR function.

Regards


Top
   
 Post subject: Thank for the help here.
PostPosted: 03 Dec 2012 8:08 
Offline
Nouveau
Nouveau
User avatar

Joined: 19 Mar 2009 9:00
Posts: 148
Location: Delhi
Thanks Mauriziog for the help here, above given solution worked


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+10:00


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited
The site created by Franck YOT. Images, logo, content and trademarks about Control-M products are property of BMC Software.
All the comments are property of their posters. Images, logo, content and design are © copyright by Scheduler-Usage.com. All Rights Reserved