Hello Kim
The reason for my trying out this approach is to fetch all the sequences that calls a job directly or indirectly.
For instance if a job A has been called in SeqQ and SeqQ has been called in SeqMain1 then if JobA is passed as an argument to this routine it should return
SeqQ,SeqMain1
If it is being called in other sequences as well(ex SeqMain2), they too shud be listed
So our answer would be SeqQ,SeqMain1,SeqMain2
Code: Select all
Dependacy(aSearchString)
DEFFUN Dependancy(aSearchstring) CALLING 'DSU.Dependancy'
NAME = aSearchString
Ans = ''
i=0
CMD = "SELECT DS_JOBS.NAME JobName from DS_JOBOBJECTS,DS_JOBS where DS_JOBOBJECTS.OLETYPE = 'CJSJobActivity' and EVAL DS_JOBOBJECTS.'@RECORD<12>' = '":NAME:"' and DS_JOBOBJECTS.OBJIDNO = DS_JOBS.JOBNO"
EXECUTE CMD CAPTURING CMDRST ;
x = convert (@FM , '|', CMDRST )
If Index(x,"0 records",1) Then
Return("")
End
Else
Str = Trim(Field(x,'|',4,(count(x,'|')-5)))
for i=1 to (count(Str,'|')+1)
Ans=Field(Str,'|',i):Dependancy(Field(Str,'|',i))
Next i
End