Page 1 of 1

How to post a job from a job that's currently executing

Posted: 29 Apr 2014 5:51
by Mel_A
How can I order a job to run, from another job that exceeds a specified run time?

Is it possible to post an In-Condition from another job when the other job exceeds a time limit?

For example: If JOB_A runs >60 minutes, how can I have JOB_B start?

Thanks.

Posted: 30 Apr 2014 12:32
by jCarlos
well in my knowledge you can do a shout with exectime as trigger but can't do a condition. in any case if your job is running on a unix/linux based system then you could do a work around (some ideas came popping up on my head)

How to post a job from a job that's currently executing

Posted: 30 Apr 2014 5:35
by Mel_A
If an exectime can do a 'trigger' of another job, that may be what I'm looking for. Let me know how this is set-up.

Posted: 01 May 2014 8:07
by Walty
Hi Mel_A,

For this issue you can use the 'ctmsys' utility --> 'Shout destination tables'
Subjet already discuss in this forum, search 'Shout Table' for some examples

Posted: 01 May 2014 6:53
by Mel_A
The 'ctmsys' utility are related with the physical destination names. I did see the Destination Type of P to send the shout to a specific program?

I could not find any samples on how a batch jobs can be triggered.

Can you provide reading materials or samples?

Thanks.

Posted: 02 May 2014 9:27
by Walty
Hi Mel_A,
Just a little example that order Job(b) if a Job(a) exceeds a specified parameters like LATETIME, LATESUB or EXECTIME

Step1:
From the "ctmsys" menu, goto "Shout Destination Tables" and define a shout destination with type "P" (program), Address Type "S" (server), Logical Destination "Order_Job" and Physical Destination "$HOME/ctm_server/my_jobs_directory/Order_Job.sh".

Step2:
Go to your "$HOME/ctm_server/my_jobs_directory and create a script named "Order_Job.sh", which contains the following lines:
#!/bin/sh
My_Schedtab=`echo $2 | awk '{print $1}'`
My_Jobname=`echo $2 | awk '{print $2}'`
My_Date=`echo $2 | awk '{print $3}'`
# order job now
ctmorder -SCHEDTAB $My_Schedtab -JOBNAME $My_Jobname -ODATE $My_Date -FORCE Y &


Note:
- The script must reside on the CONTROL-M/S machine
- The ampersand (&) at the end of the command is mandatory. This must be present for this solution to work.
- The variable that contains parameters received from SHOUT pgm is $2

Step3:
Job definition
- Goto the "PostProc" tab and define a shout WHEN LATETIME, LATESUB or EXECTIME
- in the Param box put <your value>
- in the To box put "Order_Job"
- in the Message Box put "your_parameters separed by blank" (ie : SCHEDTAB JOBNAME ODATE)

The parameters for the "Order_Job.sh" script in this example.
I hope this help you.

How to post a job from a job that's currently executing

Posted: 02 May 2014 10:21
by Mel_A
Thank you so much. It's much appreciated.

I'm now in the process of testing it in batch. I will let you know.


Thanks!

How to post a job from a job that's currently executing

Posted: 06 May 2014 8:48
by Mel_A
When the exectime of JOB_A exceeds a time limit, a job (JOB_C) is ordered in. It worked. The test was successful. Thank you.

This brings up another question.

Can this job that was brought in (JOB_C) be dependent on a file transmission? In other words, Can JOB_C once ordered, check for a file that has either come in or not?

Posted: 07 May 2014 7:35
by Walty
Yes,

In this case JOB_C must be a filewatcher job (if you want to check a file)
When the JOB_C is ordered, it will be a standard job in your AJF based on your definitions.

Posted: 07 May 2014 5:52
by Mel_A
Thanks for all the help. I'll read up on the file watcher jobs and see how they're set-up. Thanks!

All the best.

Re: How to post a job from a job that's currently executing

Posted: 28 Apr 2015 11:54
by mauriziog
The BIM job do this in a flexible manner, defined at "flow side" (the bim job mantain under control the flow were is attached).

The other solution, without BIM, is to use the method well described by Walty (defined at "job side").