Count Jobs in a project (Parallel, Server, Sequencer)

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
kmsekhar
Premium Member
Premium Member
Posts: 58
Joined: Fri Apr 16, 2010 12:58 pm
Location: Chn

Count Jobs in a project (Parallel, Server, Sequencer)

Post by kmsekhar »

Hi All,

I have jobs names like:

Server Jobs - ser_Sample1
Parallel Jobs - parl_Sample1
Sequencer - seq_Sample1

generally I am using the below commands to get the count

Code: Select all

To Count Parallel Jobs in a Project
SELECT COUNT(*) FMT '60L' FROM DS_JOBS WHERE NAME LIKE 'parl_%';

To Count Server Jobs in a Project
SELECT COUNT(*) FMT '60L' FROM DS_JOBS WHERE NAME LIKE 'ser_%';

To Count Job Sequencers in a Project
SELECT COUNT(*) FMT '60L' FROM DS_JOBS WHERE NAME LIKE 'seq_%';

Is there any alternative to get the count individually (Parallel, Server, Sequencers)?
Thanks,
Sekhar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

DS_JOBS stores the job type in a field called JOBTYPEIND from what I recall so you shouldn't need to rely on a naming convention. Search the forums for the various values and caveats on its use.
-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 »

Or don't even worry about the values, just report them.

Code: Select all

SELECT JOBTYPEIND, COUNT(*) AS JOB_COUNT FROM DS_JOBS WHERE @ID NOT LIKE '\\%' AND @ID NOT LIKE '//%' GROUP BY JOBTYPEIND;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

An alternative would be to use the command line dsjob -ljobs syntax piped through the grep command based on your naming convention, like grep ^seq, and then pipe that through the wc -l command to get the count. Try it and see if it works or if you have any questions.
Choose a job you love, and you will never have to work a day in your life. - Confucius
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ray.wurlod wrote:Or don't even worry about the values, just report them.
Unless you're not sure which is which. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

The below are the valid values for JOBTYPEIND:

Code: Select all

0 = server job
1 = mainframe job
2 = job sequence 
3 = parallel job
pandeeswaran
kmsekhar
Premium Member
Premium Member
Posts: 58
Joined: Fri Apr 16, 2010 12:58 pm
Location: Chn

Post by kmsekhar »

Thanks all
Thanks,
Sekhar
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

chulett wrote:Unless you're not sure which is which. :wink:
It should be obvious! If I saw numbers 537, 86, and 2 I'd know that for my current project that those mean Parallel, Sequence, and Server respectively. Sure, for some projects there might be some ambiguity but I'd guess that that is very unusual, one job type will usually dominate the stats.

p.s. another way to get these stats is to use my DataStage Analysis Spreadsheet to analyse a DSX export. It's a bit slow processing exports with lots of parallel jobs, but I've got a fix in the works for that.
Phil Hibbs | Capgemini
Technical Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

One man's obvious is another man's wtf.

Sure, it "should be" (hence the smiley in my post) but honestly, why would I want to report on how many "zeroes, ones and twos" each project had? Was just suggesting that the OP take a moment to lookup what each value means so there's no ambiguity no matter who sees the counts.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply