List of jobs where a parameter is used

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
sweta rai
Participant
Posts: 14
Joined: Tue Apr 01, 2008 6:56 am
Location: kolkata

List of jobs where a parameter is used

Post by sweta rai »

Is there any way to find out ; all the datastage jobs where a particular parameter from a Parameter set is used ?
Sweta
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post 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.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
sweta rai
Participant
Posts: 14
Joined: Tue Apr 01, 2008 6:56 am
Location: kolkata

Post 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 ?
Sweta
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post 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...
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
Post Reply