List of Jobs across Projects
Moderators: chulett, rschirm, roy
List of Jobs across Projects
Hi !
I am looking to get list of all Jobs in all Projects on the datastage server. My approach to this is to write a UNIX script, which will connect to each of the datastage projects, execute the command to get the job list, append to a file and move on the next project.
Is there a way I can achieve the same by writing a Datastage Routine / Job. My understanding is that I can get the get the list of Jobs for the current project only (project from where I am executing this routine). Is there a way I can pass the Projectname parameter to get the Job list ?
-Nagesh
I am looking to get list of all Jobs in all Projects on the datastage server. My approach to this is to write a UNIX script, which will connect to each of the datastage projects, execute the command to get the job list, append to a file and move on the next project.
Is there a way I can achieve the same by writing a Datastage Routine / Job. My understanding is that I can get the get the list of Jobs for the current project only (project from where I am executing this routine). Is there a way I can pass the Projectname parameter to get the Job list ?
-Nagesh
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
Correct, the DS_JOBS file exists in each project and only contains jobs in the local project. You could use the UNIX command "dsjob -lprojects" then loop for each project and use "dsjob -ljobs {projectname}"
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
ProjectJobNames = ""
Ans = @NULL
* Open VOC file - error handling omitted for clarity
Open "VOC" To fVOC Else GoTo ErrorExit
TempVOCName = "JOBS_" : @USERNO
* Get list of project names
Query = "SELECT SCHEMA_NAME TO SLIST 9 FROM UV_SCHEMA WHERE SCHEMA_NAME <> 'CATALOG';
Perform Query
* Iterate through list of project names
Loop
While ReadNext ProjectName From 9
* Create temporary VOC entry
Command = "SET-FILE " : ProjectName : " DS_JOBS " : TempVOCName
Perform Command
* Get list of job names
Query = "SELECT NAME TO SLIST 10 FROM " : TempVOCName : " WHERE NAME NOT LIKE '\\%';"
Perform Query
* Iterate through list of job names appending to list
Loop
While ReadNext JobName From 10
ProjectJobNames<-1> = ProjectName : "." : JobName
Repeat
Command = "DELETE FROM VOC WHERE @ID = '" : TempVOCName : "';"
Perform Command
Repeat
Ans = ProjectJobNames
GoTo MainExit
ErrorExit:
Call DSLogWarn("Failed to open VOC file", "Problem")
MainExit:
Last edited by ray.wurlod on Thu Jul 09, 2009 4:31 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
I am getting errors when executing the above routine. I TESTed it from DS manager. I am using Windows Server 7.5.2.
The value for @USERNO is substituted as "-2208". So TempVOCName is formed like JOBS_-2208. I am getting error like
The value for @USERNO is substituted as "-2208". So TempVOCName is formed like JOBS_-2208. I am getting error like
Code: Select all
ProjectName -- : ANAND_TST_PRJ
Command -- SET-FILE ANAND_TST_PRJ DS_JOBS JOBS_-2208
DataStage/SQL: Table "JOBS_" does not exist.
DataStage/SQL: 0 records deleted.
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I've added the missing Perform statement into the code.
I used @USERNO in case more than one user runs the code at the same time. This can be any system-wide-unique identifier.
I used @USERNO in case more than one user runs the code at the same time. This can be any system-wide-unique identifier.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Re: List of Jobs across Projects
srinagesh wrote:Hi !
I am looking to get list of all Jobs in all Projects on the datastage server. My approach to this is to write a UNIX script, which will connect to each of the datastage projects, execute the command to get the job list, append to a file and move on the next project.
Is there a way I can achieve the same by writing a Datastage Routine / Job. My understanding is that I can get the get the list of Jobs for the current project only (project from where I am executing this routine). Is there a way I can pass the Projectname parameter to get the Job list ?
-Nagesh
My suggestion would be to use the dsjob to list all the projects and store in a text file and then read line one by one from that text file and get the project name and again invoke the dsjob to get the list of jobs and append to another text file.
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: