0

Is it possible to dynamically create control-M jobs.

Here's what I want to do: I want to create two jobs. First one I call a discovery job, the second one I call a template job.

The discovery job runs against some database and comes back with an array of parameters. I then want to start the template job for each element in the returned array passing in that element as a parameter. So if the discovery job returned [a1,a2,a3] I want to start the template job 3 times, first one with parameter a1, second with parameter a2 and third one with parameter a3.

Only when each of the template jobs finish successfully should the discovery job show as completed successfully. If one of the template job instances fails I should be able to manually retry that one instance and when it succeeds the Discovery job should become successful.

Is this possible ? And if so, how should this be done ?

ward
  • 11
  • 2

2 Answers2

0

Between the various components of Control-M this is possible.

The originating job will have an On/Do tab - this can perform subsequent actions based on the output of the first job. This can be set to work in various ways but it basically works on the principle of "do x if y happens". The 'y' can be job status (ok or not) exit code (0 or not) or text string in standard output (e.g. "system wants you to run 3 more jobs"). The 'x' can be a whole list of things too - demand in a job, add a specific condition, set variables.

You should check out the Auto Edit variables (I think they've changed the name of these in the latest versions) but these are your user defined variables (use the ctmvar utility to define/alter these). The variables can be defined for a specific job only or across your whole system.

If you don't get the degree of control you want then the next step would be to use the ctmcreate utility - this allows full on-the-fly job definition.

Mark
  • 316
  • 1
  • 5
  • thanks Mark for your reply, looks promising... need to have a look at this ctmcreate utility! – ward Oct 06 '15 at 21:11
0

You can do it and the way I found that worked was to loop through a create script which then plugs in your variable name from your look-up. You can then do the same for the job number by using a counter to generate a job name such as adhoc0001, adhoc0002, etc. What I have done is to create n number of adhoc jobs as required by the query, order them into a new group and then once the group is complete send the downstream conditions on. If one fails then you can re-run it as normal. I use ctmcreate -input_file . Which works a treat.