1

I am new to Control M. I need to create a job. My job should call a shell script where I need to check whether a file has been received or not. If not, I need to send an email to a list and if so,I need to retry the job after some time. If the file is received, then I just need to execute a script and there is no need for rerun. Please help me how do i do it.

I have created the script that checks if the file has received or not in the required directory. How do I pass the information to the control M job to send the email from control M steps tab. Also how do I control the rerun if the file is received. Please help.

Megan
  • 876
  • 2
  • 10
  • 20

2 Answers2

1

It sounds like you need to split up your work into two separate jobs.

The first job should be the file watcher. Set this job to run cyclically, send email on file not found (oscompstat 7) and set to stop-cyclic and post out-condition when the file is found (oscompstat 0).

The second job would just execute the script upon receiving the out-condition from the first job.

On a side note I suggest you look into using control-m's inbuilt filewatcher utility ctmfw instead of scripting your own.

Jasper
  • 192
  • 8
0

Follow the below Steps:

  1. In your OS job, under scheduling select cyclic job and add the time interval of rerun accordingly. Ex: Every 15min. Configuring end time/ number of reruns depends on your requirement.

  2. In the shell script, get the output such a way that you can recognize whether files are received or not. Ex: output1 if you received the files, output0 if files are not received.

  3. Under Actions > On Do Actions - create a new On Specific Statement Output

    A) Statement value : *

    B) Code value: output0 -- This indicates you are searching for the output that contains output0

    C) Add Do > Notify : Under Destination select Mail and provide the details to receive information.

    a) Add another On Do Actions - create a new On Specific Statement Output

    b) Statement value : *

    c)Code value: output1 -- This indicates you are searching for the output that contains output1

    d) Add Do > Select Stop Cyclic Run -- This indicates as we received the files, we are stopping the cyclic run.

    e)Add Do > Order Job Provide the Control-M server Name: select if you are running in the same server. Folder: Provide the Folder Name Job Name: Provide the Job Name that you want to trigger after you have received the files.

Here, the Control-M job keeps on running till the output value has : output1. Once it received it stops the cyclic job.