Page 1 of 1

List of jobs where a parameter is used

Posted: Tue May 28, 2013 4:04 am
by sweta rai
Is there any way to find out ; all the datastage jobs where a particular parameter from a Parameter set is used ?

Posted: Tue May 28, 2013 4:30 am
by BI-RMA
In Advanced Find You can run a search for jobs using the parameter-set, but not the parameter itself.

Export all the jobs containing the paramter-set to a .dsx-file (design-only) and search the file for the name of the parameter.

Posted: Tue May 28, 2013 5:57 am
by sweta rai
Thanks for the Response .
But the list of jobs are huge . And again searching within the exported XML is a cumbersome process .
Is there any other alternative ?

Posted: Tue May 28, 2013 6:41 am
by BI-RMA
Hi Sweta,

not as cumbersome as You may think:

You can use DataStage to do the filtering.

Read the file sequentially, find the identifier in the line following the string "BEGIN_DSJOB", and write that to a Stage-variable.
In the following lines search for the parameter name using the Index()-Function. Set a stage-variable to True when the parameter name is found.

Write one row to the output for every job You find the parameter-name in. There is Your list...

Posted: Tue May 28, 2013 6:57 am
by chulett
Chuck Smith has already built that for you with his "DataStage tools" offerings. Check out the 'Search' or 'List' code... if it doesn't already do what you need, modify it so it does. :wink:

Posted: Tue May 28, 2013 7:00 am
by ArndW
Write a Server routine called FindParameter with one argument, 'Arg1' with the following code:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
EQUATE Comma TO ","
Ans = ""
JobList = DSGetProjectInfo(DSJ.JOBLIST)
JobCount = DCOUNT(JobList,Comma)
FOR i = 1 TO JobCount
   JobName   = FIELD(JobList,Comma,i)
   JobHandle = DSAttachJob(JobName,DSJ.ERRNONE)
   ParameterList = CONVERT(Comma,@FM,DSGetJobInfo(JobHandle,DSJ.PARAMLIST))
   LOCATE Arg1 IN ParameterList SETTING Pos ELSE Pos = 0
   IF Pos THEN Ans<-1> = JobName
   Dummy = DSDetachJob(JobHandle)
NEXT i
Ans = CONVERT(@FM,Comma,Ans)
It will return a comma separated list of jobs with the parameter passed in as a Arg1.