Link Names

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

ririr
Participant
Posts: 84
Joined: Sun Apr 04, 2004 8:59 pm

Post by ririr »

ray.wurlod wrote:What is the value of Arg1?

Don't assume, check - maybe using DSLogInfo().

If the job name is not spelled and cased correctly, DSAttachJob() will fail to attach the job. ...
"Job Name" is the Arg1 value that I pass to DSAttachJob.

Cross checked the spelling and no issues there either.

Any help is appreciated!
ririr
Participant
Posts: 84
Joined: Sun Apr 04, 2004 8:59 pm

Post by ririr »

ray.wurlod wrote:What is the value of Arg1?

Don't assume, check - maybe using DSLogInfo().

If the job name is not spelled and cased correctly, DSAttachJob() will fail to attach the job. ...
"Job Name" is the Arg1 value that I pass to DSAttachJob.

Cross checked the spelling and no issues there either.

Any help is appreciated!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try using an actual job name rather than the string "Job Name".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

Hi,
You can use shell script in After job subroutine.. :D
I have used dsjob -lstages and dsjob -llinks in the below scipt:

Code: Select all

#!/bin/ksh 
TempDir=PATHNAME 
proj=PROJECT_NAME 	#your project name 
jobname=JOB_NAME  	# name of the job for which information is required. 
. $DSHOME/dsenv 
$DSHOME/bin/dsjob -lstages $proj $jobname 2>/dev/null > $TempDir/stage.txt  
# This will give the name of each and every stage used in the job. 
 # I am using loop so that we can get link name for each and every stage used in the job. 
cat $TempDir/stage.txt |while read line                        
      do 
         stagename=`echo $line` 
	 dsjob -llinks $proj $jobname $stagename 2>/dev/null > $TempDir/LinkName.txt
	 # This will give the Link_name for each every stage 
	 # Displaying the values 
	 indx=1
         cat $TempDir/LinkName.txt | while read line 
           do 
              prjct_arry[$indx]="$line" 
              echo [$indx] $line  >>  $TempDir/LinkName1.txt 
              indx=`expr $indx + 1` 
           done
         value=`cat  $TempDir/LinkName1.txt| wc -l`
          if [ $value -gt 1 ]
          then
            linkname=`more $TempDir/LinkName1.txt  |head -1 | tail -1 | cut -d' ' -f2` 
            echo $linkname is input to $stagename >>  $TempDir/LinkName_Output.txt
            linkname=`more $TempDir/LinkName1.txt  |head -2 | tail -1 | cut -d' ' -f2` 
            echo $linkname is output to $stagename >>  $TempDir/LinkName_Output.txt
          else
            linkname=`more $TempDir/LinkName1.txt  |head -1 | tail -1 | cut -d' ' -f2` 
	    echo $linkname is input to $stagename >>  $TempDir/LinkName_Output.txt
	  fi
	 rm  $TempDir/LinkName1.txt  
      done        
 cat $TempDir/LinkName_Output.txt   
Since right now i am not having unix OS that's why i am unable to test the above code.. :?
Hope this will help you out. :wink:
http://findingjobsindatastage.blogspot.com/
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
ririr
Participant
Posts: 84
Joined: Sun Apr 04, 2004 8:59 pm

Post by ririr »

Thanks Amey. I'll give it a shot.

Ray,

I use the actual job name.

Any further suggestions are appreciated!
ririr
Participant
Posts: 84
Joined: Sun Apr 04, 2004 8:59 pm

Post by ririr »

Amey,

The script works. The only issue with this is, my client may not allow shell script work.

Thanks for your help with this.

Ideally, I'd like this done by calling DSGetLinkInfo function from a transformer stage.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

This implements the same methodology as noted early on. Why 'from a transformer'? Will you be feeding in job names from a list or query? You won't be able to call it directly there, but as discussed you'd need a routine that would take a job name as a parameter and return (I assume) a comma delimited list of the link names.

The routine code would look very similar to the posted script but with the equivalent 'DS' functions in place of the 'dsjob' calls.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply