How to get categoryname,jobname,job dependency.

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

Post Reply
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

How to get categoryname,jobname,job dependency.

Post by rafik2k »

My requirement is to get all jobs names and their corresponding job category name, and job depenency in formatted output from current datastage project.

I have create one test job where using DSGetProjectInfo (DSJ.JOBLIST), but I got only job list in the current project.

Any hints or help will be greatly appreicated.

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

Re: How to get categoryname,jobname,job dependency.

Post by ray.wurlod »

All of the DataStage API functions only operate in the current project. To work with a separate project you will need to use dsjob (which has to be told which project to attach itself to). You can, of course, invoke dsjob through DSExecute(), etc.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

There are several jobs in EtlStats which can extract this information and report on it or load it into a table.
Mamu Kim
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Post by sshettar »

Hi rafik2k ,

Could you let me know how did go about creating the test job of urs which displayed all the jobnames of the current project

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

Post by ray.wurlod »

UV or Hashed File stage querying DS_JOBS excluding any where name begins with a "/" or "\" character, returning columns NAME and CATEGORY (both VARCHAR).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

sshettar wrote:Hi rafik2k ,

Could you let me know how did go about creating the test job of urs which displayed all the jobnames of the current project

Thanks in advance
Create simple job with Transformer stage and linkt to it a sequential file stage for capturing out in text or csv format.

In transformer do the following;
1. Create one output coulmn say (jobName varchar(100))

2. put derivation for the column as:

Code: Select all

ereplace(DSGetProjectInfo(DSJ.JOBLIST), ",", CHAR(13):CHAR(10)) 
DSGetProjectInfo(DSJ.JOBLIST) will give all jobs name in comma separated format. ereplace function converts it into maany rows.


3. put one constraint on output link as

Code: Select all

  @INROWNUM<1
4. Declare one stage variable(since job has no input link so you require one stage variable for compilation)

That's it, compile and run the job.

I got this logic from Craig, Thanks Craig!


Thanks
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

ray.wurlod wrote:UV or Hashed File stage querying DS_JOBS excluding any where name begins with a "/" or "" character, returning columns NAME and CATEGORY (both VARCHAR). ...
Thanks Ray!
Do I need to create a job for same? Can you please explain me little bit more details with syntax.

Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You did? Well, umm... you're welcome! :lol:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes you need to create a job. Use a UV stage or a Hashed File stage to extract rows from DS_JOBS. The table is DS_JOBS, the two VarChar columns are NAME and CATEGORY and the selection criterion is that NAME does not begin with a slash or backslash character. In a UV stage this is a WHERE clause on the Selection tab; in a Hashed File stage it is a WITH phrase on the Selection tab. Do whatever you need to downstream of this.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply