Page 1 of 2

How do I count the total number of Jobs is a project?

Posted: Tue Oct 24, 2006 3:53 pm
by dearkriss
I know there is a command for this in datastage administrator command window. But i just can not remember what it is. any idea?

Posted: Tue Oct 24, 2006 4:00 pm
by ray.wurlod
COUNT DS_JOBS will be very close, but would include a couple of control records. COUNT DS_JOBS WITH JOBNO LIKE "1N0N" will be more accurate, or COUNT DS_JOBS WITH NAME LIKE "1A0X"

If you prefer SQL, SELECT COUNT(*) FROM DS_JOBS WHERE NAME NOT LIKE '\\%';

Posted: Wed Oct 25, 2006 6:12 am
by DSguru2B
you can also do it in the command prompt using the dsjob command

Code: Select all

dsjob -ljobs <Project Name> | wc -l

Posted: Wed Oct 25, 2006 7:37 am
by ray.wurlod
The original question stipulated "in DataStage Administrator"

:idea: To execute a UNIX command from Administrator use the SH command. For example

Code: Select all

SH -c "dsjob -ljobs <Project Name> | wc -l"
:idea: To execute a DOS command from Administrator use the DOS command. For example:

Code: Select all

DOS /C "dsjob -ljobs <Project Name>"
Of course, if you're running 7.5x2 on Windows, you can use UNIX commands.

Posted: Wed Oct 25, 2006 8:51 am
by dearkriss
Thank you Ray and DSguru2B. COUNT DS_JOBS in admin client gave me the approximate count and dsjob -ljobs <Project Name> | wc -l at command line gave the exact count. :D

Posted: Wed Oct 25, 2006 9:15 am
by splayer
Where in the Administrator client would you execute?:

COUNT DS_JOBS and
SELECT COUNT(*) FROM DS_JOBS WHERE NAME NOT LIKE '\\%';

I have access to the Administrator command prompt and I can execute:
SH -c "dsjob -ljobs <Project Name> | wc -l"

and it works but I would like to know where you would execute the first 2 commands.

Thanks.

Posted: Wed Oct 25, 2006 9:24 am
by dearkriss
You can execute the said commands in DS Admin client's projects tab...command window.

Posted: Wed Oct 25, 2006 9:37 am
by splayer
No dearkriss. In DS Administrator's client's Projects tab, I click on Command button. In this window, I can execute:

SH -c "dsjob -ljobs <Project Name> | wc -l"

and it works fine. I want to know where I can execute:
COUNT DS_JOBS and
SELECT COUNT(*) FROM DS_JOBS WHERE NAME NOT LIKE '\\%';

They don't work in the Command window.

Posted: Wed Oct 25, 2006 9:41 am
by DSguru2B
Ofcourse they do. How exactly are you typing it in ?

Posted: Wed Oct 25, 2006 10:10 am
by Lotus26
Hi,

When i tried to get the Job count for my Project! I am getting the following Error Message!

The Command issued is as follows:
SH -c "dsjob -ljobs <CMK> | wc -l"

The Error i am getting is:

SH: syntax error at line1: '|' unexpected

I tried in another way:
Command Issued: SH -c "dsjob -ljobs KMC | wc -l"
Message: SH:dsjob: not found 0

But i have some jobs in the project! My User id have Developer Access! So is it problem with User Id or any thing else.

I appreciate your help! Thanks for your time!
DSguru2B wrote:Ofcourse they do. How exactly are you typing it in ?

Posted: Wed Oct 25, 2006 10:17 am
by ArndW
Lotus26 wrote:...I tried in another way:
Command Issued: SH -c "dsjob -ljobs KMC | wc -l"
Message: SH:dsjob: not found 0
...
You need to make sure that the dsjob executable is in your path. You can change the call to "$DSHOME/bin/dsjob -ljobs KMC | wc -l"

Posted: Wed Oct 25, 2006 10:23 am
by dearkriss
to run "dsjob" from command line you have to change directory to $DSHOME/bin

Posted: Wed Oct 25, 2006 11:36 am
by ray.wurlod
And for that to work your DSHOME environment variable has to have been set.

Posted: Wed Oct 25, 2006 12:50 pm
by narasimha
Another crude way of finding the number of jobs in a project
In the Director go to

Code: Select all

View - > Uncheck "Show Categories"
All the job entries are displayed
Beware if you have thousands of jobs, it might take a pretty long time to give you results.

Posted: Wed Oct 25, 2006 1:29 pm
by ray.wurlod
... but the count will be given in the status bar. 8)