Avoid Instances--SH -c "dsjob -ljobs <Project> |

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

Post Reply
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Avoid Instances--SH -c "dsjob -ljobs <Project> |

Post by vinaymanchinila »

Hi,
I need to find the total number of jobs in a project, I can use the

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

But the issue is it also counts the instance of a job and bump the number way up, is there a way I can count Just the jobs and not instances?

Thanks,
Thanks,
Vinay
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Hmm - My dsjob -ljobs just returns job names. Invocations are returned by dsjob -linvocations. Assuming your "dsjob -ljobs" is returning a list of JOBNAME.INVOCATIONID lines (!?), you can de-duplicate and count lines like this:

Code: Select all

SH -c "dsjob -ljobs <project> | cut -d'.' -f1 | uniq | wc -l"

J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

I did try this and both commands give the same number !


SH -c "dsjob -ljobs Project1 | wc -l"


SH -c "dsjob -ljobs Project1 | cut -d'.' -f1 | uniq | wc -l "


Thanks for trying!
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Can you show us what you get from "dsjob -ljobs Project1"?
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
vinaymanchinila
Premium Member
Premium Member
Posts: 353
Joined: Wed Apr 06, 2005 8:45 am

Post by vinaymanchinila »

I am sorry, I was wrong in calulating the first time, it does not count the instances for the following command

SH -c "dsjob -ljobs proj1 | wc -l"

thanks !
Thanks,
Vinay
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Thats what i was going to say, dsjob -ljobs just retrieves the jobnames without their instances.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Thank God - I thought this thread was about to reveal some mysterious new "dsjob" behaviour I'd never encountered. :-)

J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

jhmckeever wrote:Thank God - I thought this thread was about to reveal some mysterious new "dsjob" behaviour I'd never encountered. :-)

J.
I felt the same. Thats why immediately tried the command to double check at my end and results came negative. :)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply