Quick question on querying DS_JOBS table

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Quick question on querying DS_JOBS table

Post by vivekgadwal »

All,

I need to get a list of all the jobs under a category. I have done this before using "SELECT" on "DS_JOBS" table. However, this time, I am not getting any results...

I did:

Code: Select all

user@SERVER:/opt/IBM/InformationServer/Server/DSEngine>./bin/uvsh
DataStage Command Language 8.0 Licensed Materials - Property of IBM
(c) Copyright IBM Corp. 1997, 2006 All Rights Reserved.
DSEngine logged on: Monday, May 02, 2011 11:57

>SELECT NAME FMT '60L' FROM DS_JOBS WHERE CATEGORY = 'coverage_performance';

0 records listed.
>PTERM CASE NOINVERT
>SELECT NAME FMT '60L' FROM DS_JOBS;
Job name....................................................

\\NLS

1 records listed.
>
I am 100% sure that there are jobs in the specified category. What is more perplexing to me is, this doesn't display any rows even without the filter condition. I probably am doing something wrong, so please do guide me...

Is there any alternate approach to get this list?

Thanks.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

hi what that FMt '60L' do?
i am not aware of that.

Whats the result of the below queries?

1) SELECT * FROM DS_JOBS

2)SELECT * FROM DS_JOBOBJECTS
pandeeswaran
GJ_Stage
Participant
Posts: 131
Joined: Mon Oct 27, 2008 6:59 am

Post by GJ_Stage »

Hi,

Try to do REINDEX.
Jothi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

LOGTO
-craig

"You can never have too many knives" -- Logan Nine Fingers
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

chulett wrote:LOGTO
You are correct Craig. I haven't done LOGTO prior to executing this query...However, even now, I am not getting the result

Code: Select all

>LOGTO BI_W1_DS_DW1
>SELECT NAME FROM DS_JOBS WHERE CATEGORY = 'coverage_performance';

0 records listed.
>SELECT NAME FROM DS_JOBS WHERE CATEGORY = "coverage_performance";
DataStage/SQL: syntax error.  Unexpected symbol.  Token was "coverage_performance".
Scanned command was FROM DS_JOBS SELECT NAME WHERE CATEGORY = "coverage_performance"
>
I tried 2 variations of the WHERE clause literal (one with ' and one with "). What am I doing wrong now?
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
MarkB
Premium Member
Premium Member
Posts: 95
Joined: Fri Oct 27, 2006 9:13 am

Post by MarkB »

Have you tried:

SELECT NAME FROM DS_JOBS WHERE CATEGORY = '\coverage_performance';

Make sure you are specifying the correctly spelled category - do:

SELECT DISTINCT CATEGORY FROM DS_JOBS;
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

Thanks for all your replies. The command I was providing worked now - after connecting to the project. However, I had to log-off and log back in before it worked. I didn't understand why and how it worked now as opposed to before.

So, I will put a note for next time to directly connect to the project and in case I forget to do so, exit out of dssh and log-back in again to do this.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You might do better with a LIKE query, for example CATEGORY LIKE '%coverage_performance%'.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

Thanks Ray.

A General question though is, if I have to do an exact category search, should I give something like, CATEGORY = "\Jobs\coverage_performance"? Or just CATEGORY = "coverage_performance"?
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Exact means exactly that. In SQL terms, the exact value of a column is its entire contents.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
greggknight
Premium Member
Premium Member
Posts: 120
Joined: Thu Oct 28, 2004 4:24 pm

Post by greggknight »

I run this code in a batch job. Gives me three different lists in the director job run log.
Folder is a param. The Folder option worked in versions prior to 8.0 have not tryed to figure out the issue in 8.xxx yet , to busy but I still get a list of all the jobs

Code: Select all

 FailedOpens = ""
      tablename = "DS_JOBS"
      OPEN tablename TO F.DS_JOBS Else FailedOpens<-1> = tablename

      If FailedOpens Then
         Call DSLogFatal("The following tables could not be opened: ":FailedOpens, "Msg")
      End
      TCL = 'SSELECT DS_JOBS'
      If Folder # "" Then TCL := ' WITH F3 = "...':Folder:'...."'
      EXECUTE TCL CAPTURING OUTPUT

      JobList = ""
      AllJobsDone = @FALSE
      Loop
         Readnext JobName Else AllJobsDone = @TRUE
      Until AllJobsDone Do
         If JobName[1,2] # "\\" Then
            Read Row From F.DS_JOBS, JobName Then
               JobList<-1> = FMT(JobName, "L#60"):CHAR(9):Row<5>
            End
         End
      Repeat
      Call DSLogInfo("JobList by jobname: ":@AM:JobList, "Msg")

      TCL = 'SSELECT DS_JOBS BY F5'
      If Folder # "" Then TCL := ' WITH F3 = "...':Folder:'...."'
      EXECUTE TCL CAPTURING OUTPUT

      JobList = ""
      AllJobsDone = @FALSE
      Loop
         Readnext JobName Else AllJobsDone = @TRUE
      Until AllJobsDone Do
         If JobName[1,2] # "\\" Then
            Read Row From F.DS_JOBS, JobName Then
               JobList<-1> = FMT(JobName, "L#60"):CHAR(9):Row<5>
            End
         End
      Repeat
      Call DSLogInfo("JobList by number: ":@AM:JobList, "Msg")

      TCL = 'SSELECT DS_JOBS'
      If Folder # "" Then TCL := ' WITH F3 = "...':Folder:'...."'
      EXECUTE TCL CAPTURING OUTPUT
      JobList = ""
      AllJobsDone = @FALSE
      Loop
         Readnext JobName Else AllJobsDone = @TRUE
      Until AllJobsDone Do
         If JobName[1,2] # "\\" Then
            Read Row From F.DS_JOBS, JobName Then
               JobList<-1> = JobName
            End
         End
      Repeat
      Call DSLogInfo("JobList no number: ":@AM:JobList, "Msg")
"Don't let the bull between you and the fence"

Thanks
Gregg J Knight

"Never Never Never Quit"
Winston Churchill
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

ray.wurlod wrote:Exact means exactly that. In SQL terms, the exact value of a column is its entire contents.
Pardon me for stating the question in an ambiguous way, Ray. What I meant to ask is that, in the where clause, after the '=' should I be giving:

Code: Select all

CATEGORY = '\Jobs\parent category\Child Category' (the full path) 
or ...
CATEGORY = '\parent category\Child Category' 
or just...
CATEGORY = 'Child Category'
to get the jobs list in the Child Category...

When I did CATEGORY = 'Child Category' , it did not work initially. But as I logged off and logged back on again, it seemed to give me the listing. This question is intended to get a better understanding of the Category names in the repository.

Once again, thank you all for your replies. They are really helpful.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

greggknight wrote:I run this code in a batch job.
That looks like KBA code to me... and I've always wondered how much of the things like that people have done "under the covers" would still work in the 8.x world.
-craig

"You can never have too many knives" -- Logan Nine Fingers
greggknight
Premium Member
Premium Member
Posts: 120
Joined: Thu Oct 28, 2004 4:24 pm

Post by greggknight »

Ya when he was working for ascential I had a class with him in Texas call building dataware houses with datastage about 9 or 10 years ago
"Don't let the bull between you and the fence"

Thanks
Gregg J Knight

"Never Never Never Quit"
Winston Churchill
greggknight
Premium Member
Premium Member
Posts: 120
Joined: Thu Oct 28, 2004 4:24 pm

Post by greggknight »

Right now I am running all my legacy batchs from 5.0 - 6.0 on 8.5 32 bit and 8.5 64 bit and everything runs with out issue.
I had to modify the runbatch routine to handle multiple instances but that was easy enough.

The batch compiler compiles my 2000 + jobs way faster then the gui does.
"Don't let the bull between you and the fence"

Thanks
Gregg J Knight

"Never Never Never Quit"
Winston Churchill
Post Reply