Conditional in-condition

All questions about Control-M jobs definitions
Post Reply
User avatar
GrandSteph
Nouveau
Nouveau
Posts: 17
Joined: 24 Oct 2011 12:00

Conditional in-condition

Post by GrandSteph » 09 Jan 2012 11:00

Can I define a job that will trigger if:
1 - In condition is met
or
2 - In condition does not exist ?

Basically trying to get a JOB A dependant on JOB B and JOB C only if JOB B exists, if JOB B doesn't exist then just have JOB A dependant on JOB C.

Thanks.

User avatar
fafa1975
Nouveau
Nouveau
Posts: 31
Joined: 18 Mar 2010 12:00

Post by fafa1975 » 10 Jan 2012 12:01

Hi GrandSteph,
You can try a solution with 4 jobs:
JOB A, JOB B, JOB C and "JOB B dummy".
You should run JOB B and JOB C dummy in different days and set this in IN CONDITION definition:
( JOB_B-ENDED AND JOB_C-ENDED) OR (JOB_C-ENDED AND JOB_B_dummy-ENDED).

The tricks is to schedule job B and JOB B dummy (a dummy job to execute all days JOB B is not scheduled).

I created an example on Control/M Server 6.4. I haven't tried it, but I think it could work.

This is the xml draft:
--------


<?xml version='1.0' encoding='ISO-8859-1' ?>
<!DOCTYPE DEFTABLE SYSTEM "deftable.dtd">
<DEFTABLE >
<SCHED_TABLE DATACENTER="pre-produzione62" TABLE_NAME="TEST" USED_BY_CODE="0">
<JOB
APPLICATION="TEST"
APR="0"
AUG="0"
AUTHOR="pippo"
AUTOARCH="0"
CMDLINE="test"
CONFIRM="0"
CRITICAL="0"
CYCLIC="0"
DAYS="ALL"
DAYS_AND_OR="OR"
DEC="0"
FEB="0"
GROUP="TEST"
INTERVAL="00001M"
JAN="0"
JOBNAME="JOB_A"
JUL="0"
JUN="0"
MAR="0"
MAXDAYS="0"
MAXRERUN="0"
MAXRUNS="0"
MAXWAIT="0"
MAY="0"
MEMNAME="JOB_A"
MULTY_AGENT="N"
NOV="0"
OCT="0"
OWNER="pippo"
RETRO="0"
SEP="0"
SHIFT="IGNOREJOB"
SHIFTNUM="+00"
SYSDB="0"
TASKTYPE="Command"
USE_INSTREAM_JCL="0"
WEEKDAYS="ALL"
>
<INCOND AND_OR="AND" NAME="JOB_B-ENDED" ODATE="ODAT" OP="(" />
<INCOND AND_OR="OR" NAME="JOB_C-ENDED" ODATE="ODAT" OP=")" />
<INCOND AND_OR="AND" NAME="JOB_C-ENDED" ODATE="ODAT" OP="(" />
<INCOND AND_OR="AND" NAME="JOB_B_dummy-ENDED" ODATE="ODAT" OP=")" />
</JOB>
<JOB
APPLICATION="TEST"
APR="0"
AUG="0"
AUTHOR="pippo"
AUTOARCH="0"
CMDLINE="test"
CONFIRM="0"
CRITICAL="0"
CYCLIC="0"
DAYS="ALL"
DAYS_AND_OR="AND"
DEC="0"
FEB="0"
GROUP="TEST"
INTERVAL="00001M"
JAN="0"
JOBNAME="JOB_B"
JUL="0"
JUN="0"
MAR="0"
MAXDAYS="0"
MAXRERUN="0"
MAXRUNS="0"
MAXWAIT="0"
MAY="0"
MEMNAME="JOB_B"
MULTY_AGENT="N"
NOV="0"
OCT="0"
OWNER="pippo"
RETRO="0"
SEP="0"
SHIFT="IGNOREJOB"
SHIFTNUM="+00"
SYSDB="0"
TASKTYPE="Command"
USE_INSTREAM_JCL="0"
WEEKDAYS="0,6"
>
<OUTCOND NAME="JOB_B-ENDED" ODATE="ODAT" SIGN="ADD"/>
</JOB>
<JOB
APPLICATION="TEST"
APR="0"
AUG="0"
AUTHOR="pippo"
AUTOARCH="0"
CMDLINE="test"
CONFIRM="0"
CRITICAL="0"
CYCLIC="0"
DAYS="ALL"
DAYS_AND_OR="OR"
DEC="0"
FEB="0"
GROUP="TEST"
INTERVAL="00001M"
JAN="0"
JOBNAME="JOB_C"
JUL="0"
JUN="0"
MAR="0"
MAXDAYS="0"
MAXRERUN="0"
MAXRUNS="0"
MAXWAIT="0"
MAY="0"
MEMNAME="JOB_C"
MULTY_AGENT="N"
NOV="0"
OCT="0"
OWNER="pippo"
RETRO="0"
SEP="0"
SHIFT="IGNOREJOB"
SHIFTNUM="+00"
SYSDB="0"
TASKTYPE="Command"
USE_INSTREAM_JCL="0"
WEEKDAYS="ALL"
>
<OUTCOND NAME="JOB_C-ENDED" ODATE="ODAT" SIGN="ADD"/>
</JOB>
<JOB
APPLICATION="TEST"
APR="0"
AUG="0"
AUTHOR="pippo"
AUTOARCH="0"
CMDLINE="test"
CONFIRM="0"
CRITICAL="0"
CYCLIC="0"
DAYS="ALL"
DAYS_AND_OR="OR"
DEC="0"
FEB="0"
GROUP="TEST"
INTERVAL="00001M"
JAN="0"
JOBNAME="JOB_B_dummy"
JUL="0"
JUN="0"
MAR="0"
MAXDAYS="0"
MAXRERUN="0"
MAXRUNS="0"
MAXWAIT="0"
MAY="0"
MEMNAME="JOB_B_dummy"
MULTY_AGENT="N"
NOV="0"
OCT="0"
OWNER="pippo"
RETRO="0"
SEP="0"
SHIFT="IGNOREJOB"
SHIFTNUM="+00"
SYSDB="0"
TASKTYPE="Dummy"
USE_INSTREAM_JCL="0"
WEEKDAYS="1,2,3,4,5"
>
<OUTCOND NAME="JOB_B_dummy-ENDED" ODATE="ODAT" SIGN="ADD"/>
</JOB>
</SCHED_TABLE>
</DEFTABLE>


-------------

Regards,
Fabrizio

User avatar
chrisw
Nouveau
Nouveau
Posts: 10
Joined: 15 Aug 2009 12:00

Post by chrisw » 10 Jan 2012 5:19

Hi GrandSteph

You Could use the MAYBE (#-)Condition.

JOB A will always require JOB C to run and complete, but will only need JOB B Condition if it has been ordered

In JOB A add the following IN Conditions

JOBC-TO-JOBA
#-JOBB-TO-JOBA

In JOB B add #-JOBB-TO-JOBA as an OUT Condition

This should then work


Regards

User avatar
GrandSteph
Nouveau
Nouveau
Posts: 17
Joined: 24 Oct 2011 12:00

Post by GrandSteph » 11 Jan 2012 8:41

Thanks fafa and chris,
both proposal look promising, I'll try them.
Chris' looks too good to be true ;)

Post Reply