Control-M Environment Variable Methods | Generated by AI

Home 2025.11

In BMC Control-M (both Control-M/Enterprise Manager and Control-M Automation API/Agent), there are several common and recommended ways to pass or make environment variables available to a job. Here are the most frequently used methods (from most recommended to older/legacy ones):

In Control-M Web (or Automation API JSON), you can directly define environment variables that will be set in the job’s process environment before execution.

In Control-M Web GUI:

In Automation API (JSON):

{
  "MyJob": {
    "Type": "Job:OS",
    "Command": "echo $MY_VAR",
    "Environment Variables": [
      {"MY_VAR": "HelloFromControlM"},
      {"ANOTHER_VAR": "12345"}
    ]
  }
}

These variables are automatically exported in the job’s environment on both Windows and Unix/Linux agents.

2. Using %%PARM syntax (AutoEdit variables) – Very common in legacy environments

You define variables at folder or job level and they get resolved at order/run time.

In job definition (cmm or JSON):

%%MY_VAR = some_value

or set it dynamically with:

%%MY_VAR = %%$DATE

Then in the script/command you reference it with the agent’s native syntax:

You can also set them from shouting, cyclic jobs, or via Automation API.

3. Set them explicitly in the script/command line

# Unix example
export MY_VAR=value && /path/to/script.sh

:: Windows example
set MY_VAR=value && script.bat

4. Using Control-M Agent “agentenv” or profile scripts (global for all jobs on the agent)

Not job-specific, but sometimes used:

5. Passing via “Parameters” (Local or SMART folder parameters) and then converting to env vars

You can define folder parameters and reference them as %%PARAM_NAME, then in the job do:

export MY_VAR=%%MY_PARAM

6. Using Control-M Automation API “deploy” with variables or “run” with variables

When you trigger a job via API, you can pass variables at run time:

"variables": [
  {"MY_VAR": "runtime_value"},
  {"DEBUG": "true"}
]

These become available as %%MY_VAR inside the job and are automatically exported as environment variables if you use the modern “Environment Variables” feature.

Summary – Best Practice (2024–2025)

This way you keep everything visible inside Control-M without relying on external profile scripts or wrapper scripts.


Back

x-ai/grok-4.1-fast

Donate