ctmvar
The ctmvar utility defines, deletes, modifies and displays variables. This utility can be applied to variables in the following instances:
-
A specific job in a SMART folder
-
All jobs in a SMART folder
-
Global variables
-
Pool variables
A value specified for a Global variable is overridden if a local variable with the same name is defined in a job processing definition, sub-folder or SMART folder.
Sub-folders cannot be modified using the ctmvar utility.
Creating and Editing Variables Using the ctmvar Utility
This procedure describes how to run the ctmvar utility, which enables you to define, delete, modify and display variables.
Begin
-
Do one of the following:
-
UNIX: Log in to a Control-M/Server account
-
Windows: Open a command prompt window where Control-M/Server is installed.
You can also run this utility in Control-M Agent by navigating to where Control-M/Agent is installed.
-
-
Type one of the following commands:
-
ctmvar -ACTION <action parameters> [ -QUIET ] [ -DEBUG <debug level> ]
-
ctmvar -POOL <pool parameters> [ -QUIET ] [ -DEBUG <debug level> ]
-
ctmvar -input_file <fullPathFileName>
-
ctmvar Parameters
The following table lists the ctmvar utility parameters:
Parameter |
Description |
---|---|
-ACTION |
Indicates the action to be performed on the specified variable. The possible actions are:
Variable values can also be displayed using the ctmstvar utility. However, the ctmstvar utility resolves the current value of only a specified variable or function. The ctmvar utility displays all variables in the data center or the specified SMART folder. |
-VAR |
Defines the name and location of the variable that the specified action should be applied to. Valid formats:
|
-VAREXPR |
Describes the value to be assigned to the specified variable. Valid values:
|
-FOLDER_ORDER_ID |
Determines order id of a specific folder. Only valid when you define UPDATE_FOLDER_VAR. |
-FILENAME |
Defines the path and name of the file containing the list of variables. The file must be accessible to Control-M/Server. This parameter is only valid when specified together with -action LOAD. The syntax for each line in the specified file is %%[\<ctmvar>[\<job>]]\<varName>=<expression> Specify the entire pathname in this parameter. |
-QUIET |
Suppresses the display of the results. |
-DEBUG |
Sets a debug level for the utility. This parameter is used for maintenance and troubleshooting purposes. The level, a numeric value from 0 to 5, must be used only if requested and specified by Technical Support. Performance is somewhat slower and requires a larger number of resources when operating in debug mode. BMC recommends that you activate debug mode only when absolutely necessary and revert to normal mode as soon as possible. |
-input_file |
Defines the name and full path of a file containing parameters for the utility. In this file, each parameter and its values (if any) are on a separate line with the same syntax they would have on the command line. Using the -input_file parameter enables you to:
-input_file ctmvar_parms.txt |
-POOL |
Indicates the variable action to be performed in the specified named pool. The following are possible actions:
|
ctmvar Examples
-
The following command assigns the value UP to variable %%CTMSTATUS:
ctmvar -action set -var "%%\CTMSTATUS" -varexpr "UP"
-
The following command assigns the value 31 to variable %%MONTHDAYS in the folder called PAYROLL:
ctmvar -action set -var "%%\PAYROLL\MONTHDAYS" -varexpr 31
-
The following command assigns the current value of system variable %%TIME to variable %%AAA:
ctmvar -action set -var "%%\AAA" -varexpr %%TIME
-
You can get the same result using the -input_file parameter as follows:
ctmvar -input_file var_expr_parms.txt
The referenced file contains the following lines:
-action set
-var "%%\AAA"
-varexpr %%TIME
-
The format variable %%@varname indicates that the variable should contain a value to be resolved by each job that uses it. In the following example, the command assigns the value %%@TIME to variable %%AAA:
ctmvar -action set -var "%%\AAA" -varexpr %%@TIME
-
The following command sets the name of the POOL to "test" and assigns the value %%ODATE to the variable A:
ctmvar -POOL SETVAR -POOLNAME "test" -VAR "A" -VALUE "%%ODATE"