How can i get all the jobs name in a sequence

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

dwblore
Charter Member
Charter Member
Posts: 40
Joined: Tue Mar 28, 2006 12:02 am

Post by dwblore »

kduke wrote:You maybe looping back on yourself. So you are in an infinite loop.
hi

I was hoping that this statement would coz control to return to the calling function and therefore end the loop

If Index(x,"0 records",1) Then
Return(Ans)
End

I dont see why it wud continue in a loop :(

thnx
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Recursive calls do work but I think this is a very poor idea. You are doing a SQL select without a ; at the end. Maybe that is the problem. What is the point of this? Do you just want to test recursive calls?

Edit your post and put code tags around your routine.
Mamu Kim
dwblore
Charter Member
Charter Member
Posts: 40
Joined: Tue Mar 28, 2006 12:02 am

Post by dwblore »

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 
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I think you could do this in one routine without a recursive call. That was my point. Build you a list of dependent jobs. Check the list before adding a job to make sure it is not already in the list.
Mamu Kim
ssunda6
Participant
Posts: 91
Joined: Tue Sep 19, 2006 9:32 pm

Post by ssunda6 »

Hi All,

I think using "dssearch" command is much easier if using version 7.x

dssearch -ljobs -uses -r <Project name> <job name>

"-r" recursively loops through the sub sequences also.

Regards,
ssunda.
saikrishna
Participant
Posts: 158
Joined: Tue Mar 15, 2005 3:16 am

Post by saikrishna »

Hi DS Gurus

When I try to do uvsh or dssh, I am getting the following error..

$ /home/dsadm/Ascential/DataStage/DSEngine/bin/uvsh "select jobname from dsjob"
/home/dsadm/Ascential/DataStage/DSEngine/bin/uvsh: error while loading shared libraries: libodbc.so: cannot open shared object file: No such file or directory


Thanks for your help.

Saikrishna
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Execute the dsenv script first, and make sure your LD_LIBRARY_PATH variable is correctly set (to include this library's parent directory).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
liron
Participant
Posts: 1
Joined: Sun Mar 23, 2008 2:23 am

find out jobs from master seq

Post by liron »

Code:

select
DS_JOBS.NAME JobName FMT '40L',
DS_JOBOBJECTS.NAME LinkName FMT '30L',
EVAL DS_JOBOBJECTS."@RECORD<12>" AS JobActivtyJobName FMT '40L'
from
DS_JOBOBJECTS,
DS_JOBS
where
DS_JOBOBJECTS.OLETYPE = 'CJSJobActivity'
and DS_JOBS.NAME = 'Control_Sequence'
and DS_JOBOBJECTS.OBJIDNO = DS_JOBS.JOBNO
;
regarding that code where do i enter the SEQ name ? and how do i take this code and use it in a routine /// thanx sorry for the "novice" qes//
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

You're currently looking for a sequence named 'Control_Sequence' ...
and DS_JOBS.NAME = 'Control_Sequence'
In a routine you can execute the call with ...

Code: Select all

InputArg = {YourQuery}
Call DSExecute("TCL", InputArg, Output, SystemReturnCode)
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Post Reply