Integration with Control-M

Integrating ORQA with Control-M allows for example to create test scenarios that don’t need to wait for a specific batch procedure to run: ORQA can trigger batch procedures in Control-M and monitor their completion.

To integrate ORQA with Control-M you need to do the following:

  1. Install the Control-M Automation API on the machine where ORQA is running. The Control-M API is a set of files that will allow you to simply type command lines (starting with “ctm”) for triggering Control-M actions

  2. Configure your target environment/user by typing the following command:
    ctm environment add “https://:8443/automation-api” “[ControlmUser]” “[ControlmPassword]”

You then need to determine and configure the sequence of commands that will trigger and monitor your Control-M batches. You will probably need the following sequence:

1/ ctm session login -e : this will give you in return a small JSON string containing your username and a token:
“username”: “emuser”,
“token”: “d6ad05ecbee1dd74bf100447ed2be5d6_D749761E”,
“version”: “9.0.4”

2/ ctm run order yourGroupOfJobs -e theJSONStringYouGotAtLogin: this will load your Control-M workflow and you will get in return another JSON string like:
“runId”: “e0ddf056-4497-49f7-9d8b-25758b132bd6”,
“statusURI”: “
You will need to parse this JSON string in ORQA in order to extract the runId which will be useful for the next step. You can do this easily in ORQA by using the operations “Create File from String” and “Read from JSON File”, and then do on the Java object returned by the JSON parser: myObject.runId

3/ ctm run status -e yourEnvironmentName: this will give you the list of jobId and statuses for every task in your Control-M workflow. This command has 2 purposes:

  • with the jobId you will be able to start the task which triggers the whole workflow.
  • with the status you will be able to check regularly the completion of the execution (and know when you can execute the next steps of your test scenario)

The message you will get in return can be quite long. It will look like this:

ctm run status “2d4af716-e31d-48ef-a434-16575303752d”
“statuses”: [
“jobId”: “controlm:00fhb”,
“folderId”: “controlm:005gy”,
“numberOfRuns”: 3,
“name”: “AutomationAPISampleFlow”,
“type”: “Folder”,
“status”: “Executing”,
“startTime”: “May 18, 2016 11:57:26 AM”,
“endTime”: “”,
“outputURI”: “Folder has no output”
“jobId”: “controlm:00fhc”,
“folderId”: “controlm:005gy”,
“numberOfRuns”: 3,
“name”: “AutomationAPISampleFlow/CommandJob”,
“type”: “Command”,
“status”: “Wait Host”,
“startTime”: “”,
“endTime”: “”,
“outputURI”: “Job didn’t run, it has no output”

You will probably know in advance the name of the task which triggers the workflow and the name of the task whose status is an indicator of the completion of the execution. You will then need to parse this JSON message to get the jobId and status of these specific workflow tasks. Again you will need to use in ORQA the “Create File from String” and “Read from JSON File” operations, and once you have the Java object you can simply do a “Loop Through Set” on myJavaObject.statuses and inside the loop you can have an “Do If True” operation which compares the current name with your specific name and then stores the jobId or status in a variable.

4/ ctm run job::confirm myJobId: this will start the corresponding workflow task (which will potentially trigger the whole workflow)

Once the workflow is started in step 4, you can repeat step 3 to regularly monitor the statuses in your workflow.

The Control-M API is documented here: