Page 1 of 1

How to get categoryname,jobname,job dependency.

Posted: Mon Jun 18, 2007 8:33 am
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.

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

Posted: Mon Jun 18, 2007 2:43 pm
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.

Posted: Mon Jun 18, 2007 6:56 pm
by kduke
There are several jobs in EtlStats which can extract this information and report on it or load it into a table.

Posted: Tue Jun 19, 2007 1:41 pm
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

Posted: Tue Jun 19, 2007 3:01 pm
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).

Posted: Wed Jun 20, 2007 12:39 am
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

Posted: Wed Jun 20, 2007 7:08 am
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

Posted: Wed Jun 20, 2007 7:10 am
by chulett
You did? Well, umm... you're welcome! :lol:

Posted: Wed Jun 20, 2007 5:00 pm
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.