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

Post Reply
User avatar
Mel_A
Nouveau
Nouveau
Posts: 13
Joined: 11 Jul 2013 12:00

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

Post by Mel_A » 29 Apr 2014 5:51

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.

User avatar
jCarlos
Nouveau
Nouveau
Posts: 36
Joined: 19 Jun 2013 12:00

Post by jCarlos » 30 Apr 2014 12:32

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)

User avatar
Mel_A
Nouveau
Nouveau
Posts: 13
Joined: 11 Jul 2013 12:00

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

Post by Mel_A » 30 Apr 2014 5:35

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.

User avatar
Walty
Nouveau
Nouveau
Posts: 473
Joined: 20 Jan 2006 12:00

Post by Walty » 01 May 2014 8:07

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
Best regards
Walty

User avatar
Mel_A
Nouveau
Nouveau
Posts: 13
Joined: 11 Jul 2013 12:00

Post by Mel_A » 01 May 2014 6:53

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.

User avatar
Walty
Nouveau
Nouveau
Posts: 473
Joined: 20 Jan 2006 12:00

Post by Walty » 02 May 2014 9:27

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.
Best regards
Walty

User avatar
Mel_A
Nouveau
Nouveau
Posts: 13
Joined: 11 Jul 2013 12:00

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

Post by Mel_A » 02 May 2014 10:21

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!

User avatar
Mel_A
Nouveau
Nouveau
Posts: 13
Joined: 11 Jul 2013 12:00

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

Post by Mel_A » 06 May 2014 8:48

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?

User avatar
Walty
Nouveau
Nouveau
Posts: 473
Joined: 20 Jan 2006 12:00

Post by Walty » 07 May 2014 7:35

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.
Best regards
Walty

User avatar
Mel_A
Nouveau
Nouveau
Posts: 13
Joined: 11 Jul 2013 12:00

Post by Mel_A » 07 May 2014 5:52

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.

User avatar
mauriziog
Nouveau
Nouveau
Posts: 807
Joined: 08 Jun 2007 12:00
Location: Varese - Italy
Contact:

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

Post by mauriziog » 28 Apr 2015 11:54

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").

Post Reply