How to create job with NOT OK out condition

All questions about Control-M jobs definitions
Post Reply
User avatar
gwr_d
Nouveau
Nouveau
Posts: 12
Joined: 25 Jan 2010 12:00

How to create job with NOT OK out condition

Post by gwr_d » 28 Jan 2010 8:47

Hi All,

I need to create a job , if the job ended not ok then next job should trigger.Please help

Thanks

User avatar
philhaut
Nouveau
Nouveau
Posts: 32
Joined: 06 Feb 2007 12:00
Location: VALENCIENNES

Post by philhaut » 28 Jan 2010 9:22

Hi,

in the step panel
on Statement Stmt= * Code= NOTOK
Do Condition Name= JOB-OK Date= ODAT Sign= +

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

Post by Walty » 28 Jan 2010 9:24

Hi,

- Put in job definition (Steps Codes):

ON STMT * CODE COMPSTAT != 0
DO COND RUN_NEXT_JOB ODAT +


or

ON STMT * CODE NOTOK
DO COND RUN_NEXT_JOB ODAT +


- Put the RUN_NEXT_JOB ODAT in the IN conditions panel to run the successors when needed.
Best regards
Walty

User avatar
gwr_d
Nouveau
Nouveau
Posts: 12
Joined: 25 Jan 2010 12:00

Post by gwr_d » 28 Jan 2010 2:02

thanks for the information
i'm new to controlm and dont know how to code
can you please explain more
what should i give in the statement tab
and in code tab

dmcampbell

Post by dmcampbell » 29 Jan 2010 2:56

Another option would be to code it as follows:

ON Statement Stmt=* Code=NOTOK
DO OK

This would just mark the job as ending OK no matter how the actual execution of the task ended it would be set to an OK state.

User avatar
brownbag
Nouveau
Nouveau
Posts: 161
Joined: 11 Oct 2007 12:00
Location: Melbourne

JOB ENDED NOTOK

Post by brownbag » 08 Feb 2010 6:49

BE VERY CAREFUL how you do this.
- It is not a good practice never to just do an OK when a job fails so that you can run the next job.
- It is also not a good pratice to create a condition that makes it look like the job has succeeded (such as JOBA-OK when JOBA fails).

The above methods can affect other jobs that may depend on your job (or other jobs that you may add later that depend on your job).

It is better to have a standard where you create a condition JOBA-OK where JOBA succeeds and JOBA-NOTOK (or similar) when JOBA fails.

Then you can make a dependencies work how you need in the in-conditions of any subsequent jobs:
- Job dependent on JOBA-OK - runs when JOBA completes successfully.
- Job dependent on JOBA-NOTOK - runs when JOBA fails.
- Job dependent on JOBA-OK or JOBA-NOTOK - run when JOBA completes (whether successful or not).

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

Post by mauriziog » 11 Feb 2010 10:19

I dont agree brownbag,
many different condition is not a better way to do.
In this case the job end NOTOK, so its RED and the following flow proceed: is clear that the red jobis ended wrong.

User avatar
ejtoedtli
Nouveau
Nouveau
Posts: 51
Joined: 19 Nov 2008 12:00
Location: Portland, Or. - U.S.A.

Post by ejtoedtli » 11 Feb 2010 11:32

I fell that a better approach is to look for specific values in COMPSTAT. The majority of our jobs are coded to end NOTOK if anything other han zero is detected. However, we do have some jobs setup that take different actions based upon various values.

We also learned an interesting lesson a couple of months ago. COMPSTAT sometimes has a value that was set by the OS of the agent machine rather than the script that it was supposed to execute. I don't remember the exact details of what happened. I happened to show the value of COMPSTAT from one job to a UNIX administrator and he recognized the code immediatly.

User avatar
brownbag
Nouveau
Nouveau
Posts: 161
Joined: 11 Oct 2007 12:00
Location: Melbourne

BEST APPROACH

Post by brownbag » 14 Feb 2010 10:59

Maurizog,
You are entitled to disagree, but think about what you are suggesting - to create a condition that reflects something that isn't true. In relation to maintenance it can be confusing.
And what happens if another job is dependent on the first job succeeding - if you've created an -OK condition on failure how can you do that unless you have a good set of strict standards, as I have suggested. There are other ways to do it but they are even more confusing.
Remember - any method that follows set standards is better and makes your system easier to maintain, especially for the person that comes into the job after you.

Post Reply