It is currently 21 Jul 2018 9:49


Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 14 Feb 2013 4:44 
Offline
Nouveau
Nouveau
User avatar

Joined: 24 Jul 2012 12:00
Posts: 28
Location: Long Beach, CA
I set a variable for ODATE plus one day in tables and jobs using this in the SET tab: %%$CALCDATE %%ODATE +1
and it works just fine.
Now, I want to use it as a global var. So, the following "should" work, but doesn't. Gets message: CALCDATE: Undefined variable. Go figure?
ctmvar -action set -var "%%\ODATE1" -varexpr %%@$CALCDATE %%@ODATE +1 "
The following does not work either
ctmvar -action set -var "%%\ODATE1" -varexpr "%%$CALCDATE %%@ODATE +1 "
Any suggestions? I opened an issue with BMC, I will update if they have anything.


Top
   
 Post subject:
PostPosted: 14 Feb 2013 4:50 
Offline
Nouveau
Nouveau
User avatar

Joined: 26 Apr 2005 12:00
Posts: 710
Location: PARIS
Hi

%%CALCDATE is not a variable but a function.

So %%@CALCDATE is not possible.
And be care full about that thing.

%%CALCDATE must only use dates having YYMMDD format.
%%$CALCDATE using CCYYMMDD format.

So if you want to calculate something using %%ODATE, you must use %%CALCDATE and in case of you want to work with century unsing %%$ODATE, function will be %%$CALCDATE


Top
   
PostPosted: 14 Feb 2013 5:14 
Offline
Nouveau
Nouveau
User avatar

Joined: 24 Jul 2012 12:00
Posts: 28
Location: Long Beach, CA
Thanks for the info on $CALCULATE. My command works just fine when in a Table or job, and as I understand it, the table and job just invoke ctmvar behind the scenes. It seems to me that it should work as a command for global as well.


Top
   
 Post subject:
PostPosted: 14 Feb 2013 6:25 
Offline
Nouveau
Nouveau
User avatar

Joined: 14 Jan 2010 12:00
Posts: 58
Correct me if I am wrong but you cannot execute %%CALCDATE from the command line. It is a bmc internal function.


Top
   
PostPosted: 14 Feb 2013 6:29 
Offline
Nouveau
Nouveau
User avatar

Joined: 24 Jul 2012 12:00
Posts: 28
Location: Long Beach, CA
Think about what I am trying to do. I am not actually trying to EXECUTE the $CALCULATE. I am only trying to ASSIGN it to a global variable where it will be evaluated later when a JOB tries to use the global variable. The "@" signs indicate that the %% values are to be evaluated at execution time, NOT when the variable are created.
I think I am going to try to create the global var in a JOB, and see if that works.


Top
   
PostPosted: 14 Feb 2013 9:19 
Offline
Nouveau
Nouveau
User avatar

Joined: 24 Jul 2012 12:00
Posts: 28
Location: Long Beach, CA
It would seem that you are not entirely correct. When you think about it, what I am trying to do is put $CALCULATE into a global variable to be executed later. I am NOT trying to execute it. While it is in the global variable it is just a character string. That's all.
To test my theory, I decided to create the Global Var in an actual Job, rather than explicitly with the ctmvar command. Your suggestion of a daily job to do this is what gave me the idea. So I did the SET tab as follows
VARNAME VALUE
%%\ODATE1 %%@$CALCDATE %%@ODATE +1

And displayed the value of ODATE1 in a DOMAIL Message.

I ran the JOB and Here is what I see in my global var listing... exactly what I wanted to see.
epspubmdv-bmdadm [47] ctmvar -action list
<<<GLOBAL>>>

VAR VAREXPR
---------------------------------------- ---------------------------------
%%CyclicTime 092100
%%CyclicDate 130214
%%PDQ Q
%%pdq q
%%ecc eq2
%%ECC EQ2
%%gts gq2
%%GTS GQ2
%%scm sq2
%%SCM SQ2
%%eMailCC1
%%eMailCC2
%%eMailCC3
%%eMailTO1 CTM_ECC_DEV@ea.espon.com
%%eMailTO2
%%eMailTO3
%%eMailSubj %%@PDQ. Control-M - Failure Type:%%@JobT
%%eMailMsg00 %%@PDQ. %%@JOBNAME.-%%@ORDERID > Job-Ord
%%eMailMsg01 %%@PDQ. YYMMDD-HHMMSS : %%@ODATE.-%%@TIM
%%eMailMsg02 %%@PDQ. DataCenter : %%@DATACENTER. N
%%eMailMsg03 %%@PDQ. Application : %%@APPLIC.
%%eMailMsg04 %%@PDQ. Group : %%@APPLGROUP.
%%eMailMsg05 %%@PDQ. Owner : %%@OWNER.
%%eMailMsg06
%%eMailMsg07
%%eMailMsg08
%%eMailMsg09
%%JobType SAP
%%ODATE1 %%@$CALCDATE %%@ODATE +1

And here is the result in my eMail... My only concern is why the closing double quote disappeared.

Mail message from CONTROL-M:
"Q"
"20130215
"Q TS_JLM_eMail_GVar-0148b > Job-Orderid Ended with Errors."
"Q YYMMDD-HHMMSS : 130214-120818 => YYMMDD-HHMMSS Date-Time"
"Q DataCenter : NON-PROD NodeID: aix15a"
"Q Application : TS_JLM"
"Q Group : TS_JLM_eMail"
"Q Owner : root"
""
""
""
""
I will send BMC a bill for my consulting fee. Please feel free to use this any time.


Top
   
PostPosted: 15 Feb 2013 3:39 
Offline
Nouveau
Nouveau
User avatar

Joined: 24 Jul 2012 12:00
Posts: 28
Location: Long Beach, CA
Got this from BMC support. A good approach to this thing...
You might also want to consider using a list of variables that is accessed via the %%LIBMEMSYM variable. The %%LIBMEMSYM AutoEdit variable can be used in the AutoEdit Assignment or Do AutoEdit parameters to indicate a text file containing a list of AutoEdit assignments. This variable enables you to create a central file containing AutoEdit assignment statements that can be read by many job processing definitions. In the Control-M Parameters Guide, there is a section that describes %%LIBMEMSYM and there are some examples of how %%$CALDATE can be used in one of those members.
For example... The job processing definition might contain the following:
%%a=1
%%LIBMEMSYM=/controlm/ctm/autoedit.common1
%%PARM1=%%c
And the file /controlm/ctm/autoedit.common1 contains the following entries:
%%c=%%$CALCDATE %%ODATE +%%a
When the job is submitted for execution by Control-M, AutoEdit variables are resolved as if the AutoEdit Assignment parameter contained the following entries:
%%a=1
%%c=%%$CALCDATE %%ODATE +%%a
%%PARM1=%%c


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

All times are UTC+02: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