ctmvar global var with both %%@var AND character string

All questions about Control-M jobs definitions
Post Reply
User avatar
Nightwatchrenband
Nouveau
Nouveau
Posts: 28
Joined: 24 Jul 2012 12:00
Location: Long Beach, CA

ctmvar global var with both %%@var AND character string

Post by Nightwatchrenband » 12 Feb 2013 8:32

When the %%@var is BEFORE the char string it WORKS
When the Char string is before the %%@var it FAILS
Anyone know how to get around this?
Example:
ctmvar -action set -var "%%\eMailMsg07" -varexpr "This is jobname: %%@JOBNAME."
ctmvar -action set -var "%%\eMailMsg08" -varexpr "%%@JOBNAME. This is jobname"
VAR VAREXPR
---------------------------------------- ------------------------
%%CyclicTime 092100
%%eMailMsg07 This is jobname:
%%eMailMsg08 %%@JOBNAME. This is jobname

User avatar
fyot
Nouveau
Nouveau
Posts: 736
Joined: 26 Apr 2005 12:00
Location: PARIS
Contact:

Post by fyot » 13 Feb 2013 7:31

HI

dot character is used to concatenate.
So if Control-M considers the dot as necessary in the command, you just need to double it.

In that case Control-m will consider that you want to concatenate " with JOBNAME. So if you want to terminate with the dot, try this.

ctmvar -action set -var "%%\eMailMsg07" -varexpr "This is jobname: %%@JOBNAME.."

User avatar
Nightwatchrenband
Nouveau
Nouveau
Posts: 28
Joined: 24 Jul 2012 12:00
Location: Long Beach, CA

No go on the "."

Post by Nightwatchrenband » 13 Feb 2013 7:03

Tried your suggestion. Here is the result
%%eMailMsgXX This is jobname: .
It just added a "." to the end
What I should get is
%%eMailMsgXX This is jobname: %%@Jobname
Many folks seem to think of the "." as a concatenation char. I think this leads to problems. It will work better if they think of is as a "terminator" for a symbolic variable. The "." says $UnixVarEnds. ends where the "." is. This prevents the confusion when you wish to concatenate $UnixVarEnds.someotherstring. Anyhow, in my case above the "." or no "." makes no difference.

User avatar
fyot
Nouveau
Nouveau
Posts: 736
Joined: 26 Apr 2005 12:00
Location: PARIS
Contact:

Post by fyot » 13 Feb 2013 7:50

Hi

I confirm dot is used to concatenation string.
Usage is not simple

In your case try this:
Your text : .%%JOBNAME..

User avatar
Nightwatchrenband
Nouveau
Nouveau
Posts: 28
Joined: 24 Jul 2012 12:00
Location: Long Beach, CA

Same results.

Post by Nightwatchrenband » 13 Feb 2013 8:08

epspubmdv-bmdadm [31] ctmvar -action set -var "%%\eMailMsgXX" -varexpr "This is jobname:.%%@JOBNAME.."
Gets
%%eMailMsgXX This is jobname:..
I just got a reply back from BMC, they say that when using %%@ vars they MUST be at the beginning of the varexpr string. I do not "like" the answer, but that appears to be the way they wrote their command interpreter and I doubt they are interested in fixing it.

User avatar
fyot
Nouveau
Nouveau
Posts: 736
Joined: 26 Apr 2005 12:00
Location: PARIS
Contact:

Post by fyot » 13 Feb 2013 8:51

Hi Just tested

If Jobname is defined you will have correct result using following syntax:
JOBNAME value is Job1023

-varexpr "This is jobname: %%@JOBNAME."
result : This is jobname: Job1023

-varexpr "This is jobname: .%%@JOBNAME."
result : This is jobname: .Job1023

-varexpr "This is jobname: %%@JOBNAME.."
result : This is jobname: Job1023.

-varexpr "This is jobname: .%%@JOBNAME.."
result : This is jobname: .Job1023.

User avatar
Nightwatchrenband
Nouveau
Nouveau
Posts: 28
Joined: 24 Jul 2012 12:00
Location: Long Beach, CA

Here is what I get when I try it

Post by Nightwatchrenband » 13 Feb 2013 11:38

Below is the log from my unix system. Note that eMailMsg03 is defined to be what I am trying for because I start the Varexpr with another %%@ var. But eMailMsgXX is not. By the way, Jobname is a standard Control-M variable set by every running job. I do not want that var set until an actual job is running. That is why the "@" sign

epspubmdv-bmdadm [33] ctmvar -action set -var "%%\eMailMsgXX" -varexpr "This is jobname: %%@JOBNAME."

Action SET performed successfully.
epspubmdv-bmdadm [34] ctmvar -action list
<<<GLOBAL>>>

VAR VAREXPR
---------------------------------------- ---------------------------------
%%CyclicTime 092100
%%CyclicDate 130213
%%eMailMsg03 %%@PDQ. Application : %%@APPLIC.
%%eMailMsgXX This is jobname:

User avatar
fyot
Nouveau
Nouveau
Posts: 736
Joined: 26 Apr 2005 12:00
Location: PARIS
Contact:

Post by fyot » 14 Feb 2013 12:31

Ok

So if that command is done thru your control-m job,
JOBNAME variable should be %%JOBNAME and not %%@JOBNAME.

%%@ is a global variable resolved by each job.

User avatar
Nightwatchrenband
Nouveau
Nouveau
Posts: 28
Joined: 24 Jul 2012 12:00
Location: Long Beach, CA

Well, yes

Post by Nightwatchrenband » 14 Feb 2013 1:28

Yes, that is true.
But the whole point of assigning Global variables server-wide means that I can define variables at the global level which may then be used by every job any yet have unique values because of the %%@. In this case %%\eMailMsgXX is going to be used in a DOMAIL to show the jobname. But rather than putting Jobname: %%Jobname in the DOMAIL I place %%eMailMsgXX which will interpret the value of %%Jobname at job run time. This allows me to change the eMail message for every job just by changing the Global variable. It also simplifies my Job templates. This makes things easier to manage for several thousand jobs. Of course %%eMailMsgXX may be overridden at Smart Table or Job level as matters dictate.

User avatar
fyot
Nouveau
Nouveau
Posts: 736
Joined: 26 Apr 2005 12:00
Location: PARIS
Contact:

Post by fyot » 14 Feb 2013 7:30

Hi

It's a good idea !!!

So be care full about global variable usage.
Considering every jobs submitted will try to resolve variable, even if job is not defined to use that variable.
You will multiply number of SQL request in the database.

That case could create a very important latency.
You can verify it taking time between two jobs linked thru a condition, without any sleep.
Time between them must be less than the minute.
If not, you have latency, and Global variable could be responsible.

User avatar
Danny
Nouveau
Nouveau
Posts: 21
Joined: 18 May 2010 12:00
Location: EMEA
Contact:

Post by Danny » 14 Feb 2013 3:53

When the varexpr must start with a %%@ variable, you can try something like this:

ctmvar -action set -var "%%\eMailMsg07" -varexpr "%%@BLANK1.This is jobname: %%@JOBNAME.."

User avatar
Nightwatchrenband
Nouveau
Nouveau
Posts: 28
Joined: 24 Jul 2012 12:00
Location: Long Beach, CA

Thanks

Post by Nightwatchrenband » 14 Feb 2013 4:33

FYOT! Thanks for the tip on the latency. I'll check
Danny! That indeed works and I set up a symbol which resolves to a blank for the first %%@. Seems to me that if BMC had written their software a little better, it would not be a problem, but I doubt they will ever get around to fixing it. "Working as designed", indeed.
I am about to post another brain teaser on globals. stay tuned.

User avatar
livcyxingfoe
Nouveau
Nouveau
Posts: 3
Joined: 08 Apr 2013 12:00
Contact:

Post by livcyxingfoe » 08 Apr 2013 8:26

I just got a reply back from BMC, they say that when using %%@ vars they MUST be at the beginning of the varexpr string.




_________________
Runescape Gold|cheap runescape gold|Diablo 3 Gold

User avatar
jaysismyson
Nouveau
Nouveau
Posts: 2
Joined: 03 Aug 2013 12:00

Post by jaysismyson » 03 Aug 2013 10:29

the whole point of assigning Global variables server-wide means that I can define variables at the global
Buy lineage2 adena
level which may then be used by every job any yet have unique values because of the %%@. In this case %%\eMailMsgXX is going to be used in a DOMAIL to show the jobname. But rather than putting Jobname

User avatar
chrisjacob
Nouveau
Nouveau
Posts: 1
Joined: 21 Jan 2014 12:00

Post by chrisjacob » 21 Jan 2014 11:07

Can someone share here the whole character string here? I am newbie here, and trying to learn the language. I had done a basic course before some which gave me a vague idea what it is. Waiting to read more about the codes and strings.



CHRIS
microsoftsupportnow.com

Post Reply