Doubt

Everything about Control-M Server installation or setup.
Post Reply
Nancy

Doubt

Post by Nancy » 23 Dec 2009 8:31

Hi Chaps,
Can we assign an Environmetal variable to a Global variable in Control-M?

Nancy

User avatar
Walty
Nouveau
Nouveau
Posts: 473
Joined: 20 Jan 2006 12:00

Post by Walty » 24 Dec 2009 12:24

Hi,

I suggest to use the %%LIBMEMSYM parameter or the ctmvar utility.

If you used the %%LIBMEMSYM the file specified must reside on the Control-M/Server box and the full path must specified, like:

%%LIBMEMSYM=/controlm/ctm_server/your_path/your_autoedit_file

The usage for global variable the ctmvar is more flexible.

Usage: ctmvar -action set -var "%%\Variable_name" -varexpr "Global_variable_value"

Example: Put in your script

set My_Env_var=`hostname`
ctmvar -ACTION SET -var "%%\CTM_GBL_VAR1" -varexpr "$My_Env_var"


Now the %%CTM_GBL_VAR1 is a Global Variables for Controlm and all jobs can use it.

Don't forget to manage (delete) unused Global Variables at the end of the day.
If you want more detail go to see CONTROL-M Job Parameter and Variable Reference Guide.
Best regards
Walty

User avatar
nicolas_mulot
Nouveau
Nouveau
Posts: 149
Joined: 07 Jan 2010 12:00

Post by nicolas_mulot » 07 Jan 2010 11:50

Nancy,
A good trick is to define those global variables every day using a service job, which runs daily.
Typically, this is a Dummy job which includes the following code:
ON STMT * CODE *
DO SETVAR %%\VAR1=<the>

In addition, some control-m parms can be directly specified as environement variable.
In your case, the value can be an environment variable.

I made a test like this, under windows:
ON STMT * CODE * DO SETVAR %%\COMP=%%COMPUTERNAME.

As a result, "ctmvar -action list" correctly displays the variable %%COMP with the name of my computer.

If you have a chance to make the test under Unix (which I dont have), pls let me know
Cheers
Nicolas_Mulot

User avatar
nicolas_mulot
Nouveau
Nouveau
Posts: 149
Joined: 07 Jan 2010 12:00

Post by nicolas_mulot » 11 Jan 2010 12:27

Nancy,
There was a slight mistake in my previous post.

Instead of:
ON STMT * CODE * DO SETVAR %%\COMP=%%COMPUTERNAME
.. which refers to an unexisting %%COMPUTERNAME AutoEdit variable,

One should have read:
ON STMT * CODE * DO SETVAR %%\COMP=%COMPUTERNAME%
.. which refers to the environment variable %COMPUTERNAME%

Sorry for that

Nicolas Mulot

Post Reply