control-m中查找前置job和后置job

USE [CTRLM]
GO

-- Find Successors
SELECT JOBNAME,SCHEDTAB,* FROM CMR_AJF
WHERE ORDERNO IN (
SELECT C.ORDERNO FROM CMR_AJF A
INNER JOIN CMR_CON_J B ON A.ORDERNO=B.ORDERNO
INNER JOIN CMR_CON_J C ON C.ROWTYPE = 'I' AND B.CONDNAME=C.CONDNAME
WHERE  B.ROWTYPE='O' AND B.OP='+' AND A.JOBNAME='PSIMED_MPI_MAINTENANCE'
) AND TASKTYPE<>'G'

-- Find Predecessors
SELECT JOBNAME FROM CMR_AJF
WHERE ORDERNO IN (
SELECT C.ORDERNO FROM CMR_AJF A
INNER JOIN CMR_CON_J B ON A.ORDERNO=B.ORDERNO
INNER JOIN CMR_CON_J C ON C.ROWTYPE = 'O' and C.OP = '+' AND B.CONDNAME=C.CONDNAME
WHERE  B.ROWTYPE='I' AND A.JOBNAME='PSIMED_MPI_MAINTENANCE'
) AND TASKTYPE<>'G'


你可能感兴趣的:(control-m中查找前置job和后置job)