7 Replies Latest reply: Aug 2, 2012 9:05 PM by Joe Goldberg RSS

Control-M Brain Teaser

yotam Wimmer

There are two types of jobs: TypeA and TypeB.  TypeB jobs should not start executing if any TypeA job is running.

In other words:

 

All TypeA jobs can run at any time.

All TypeB jobs can run as long as  jobA Type job is NOT running.

  • 1. Re: Control-M Brain Teaser
    Swati B

    Can I know what you mean to say by "jobA Type job is NOT running"? Does it mean Job TypeA has ended execution (either Ok orNotOk)?

    If it is so, then this is regarding "Pre conditions". You have to add all type A job's "out conditions" to the Type B jobs as "in conditions".

  • 2. Re: Control-M Brain Teaser
    yotam Wimmer

    Hi Star,

    in regards to your answer consider:

     

    1. no TypeA job is currently running

    2. TypeB job  should be able to run, the job wont run as no typeA job has run and created a pre condition.

     

    lets take an example

     

    1.  job1 job11  is  from TypeA

    2. job2 job22  is  from TypeB

     

    example 1

    • job1 has started executing
    • job2 should be able to start when job1 has ended (both Ok and NotOk)

    example 2

    • job1 and job11 has started executing
    • job2 can only start when both job1 and job11 ended (Ok/NotOk)

    example 3

    • job2 has started executing
    • job1 can also start executing
    • job2 finished executing
    • job22 can only start once job1 has ended ( Ok/notOk)

     

    thanks

  • 3. Re: Control-M Brain Teaser
    Swati B

    Ok, in your scenario, the job hierarchy would be like this.

     

     

    In this job 1 can execute any time. So define it as you want to run it, (give time/ cyclic,etc without any condition)

     

    For Job11 you want it to run after 1 completed either successfully or fail.( Add conditions in step tab of 1 as : On stat=* Code = NOTOK ; Do condition name =1 ended, date = odat, sign +. add same if code is Ok.)

     

    For job 2, job can start when job 1 and 11 ended ,should start when job 1 ended. So add 'In condition = 1ended". Same for job22.

     

    You can check the pre req. conditions in Tools-> Pre req conditions.

     

    Hope this will be helpful.

  • 4. Re: Control-M Brain Teaser
    yotam Wimmer

    Hi Star

    i just gave an example.

    lets take another example

     

    there are 1000 TypeA jobs and 500 TypeB jobs.

    there is no dependency between the jobs . the only rule is

     

    TypeB job cannot start running if typeA job is executing.

  • 5. Re: Control-M Brain Teaser
    Swati B

    Still we have to give dependency between tables, Group All jobs of type A in Table A, and all jobs of type B in table B, and create dependency between tables.

     

    There is a rule, means there must be a condition, and we can achieve it by d same.

     

    If anything else, I realy need to search

  • 6. Re: Control-M Brain Teaser
    yotam Wimmer

    Hi Star,

     

    not all TypeA jobs can be in the same table same for TypeB jobs. some are in smart tables, some are not related to each other.

     

    so grouping all TypeA jobs into a table and TypeB jobs into another table is not possible.

    :-)

  • 7. Re: Control-M Brain Teaser
    Joe Goldberg

    Repeating my post from a LinkedIn Group for general consumption:

     

    In order to get a completely flexible solution, you have to do a bit of scripting. For distributed platforms, here is what I would suggest.

    Use Pre/Post scripts as follows:
    All TypeA jobs have a pre and post script. TypeB jobs have an IN Condition like "TypeA_Not_Running"

    When A TypeA job starts, the pre script starts:
    1) Delete TypeA_Not_Running  (If neatness counts, evaluate TypeACount and do the delete only if zero)
    3) Increment TypeACount

    When a TypeA job completes, the Post Script:
    Decrements TypeACount
    If zero, add TypeA_Not_Running

    When TypeA_Not_Running exists, TypeB jobs start.