Getting Row count for all hash files in a category

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Getting Row count for all hash files in a category

Post by Andal »

I want to know how to get rowcount for all the hash files in a prticular category or in a project.

For getting rowcount for a single Hashfile we are using

"Select Count(*) from HashFileName", is there some thing like this to get the count for all the Hashfiles used in a category.

Rgds
Andal.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello Andal,

there probably is, but you need to add the selection of the category to your query. How do you differentiate your "Categories"? Is it by location? By file name?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There isn't.

You could create a job sequence to identify the hashed files then run a job to count the records in each, appending the results to a file or inserting into a database.

Do you want to include all the hashed files that make up the repository?

Is there a standard location for your hashed files? That would affect the mechanism you choose for identifying the hashed files.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Post by Andal »

My hash files are in the same folder where my project lies, we will categorize the hash files by functional wise, ex for Finance related jobs we will be having a category like Finance_Intial_Load, and for purchase we are having Purchase_intial_Load.

I am having the list of hash files used in each category , but how can i use them as a parameter and loop the job.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Andal,

if you have a list of files then you can use the loop construct within a sequence job and iterate through the list call up your counting job for each Hash file object.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Code: Select all

select 
   EVAL DS_JOBOBJECTS."@RECORD<6>" AS FILE_NAME FMT '35L',
   DS_JOBS.NAME AS JOB_NAME FMT '35L', 
   DS_JOBOBJECTS.NAME AS LINK_NAME FMT '35L'
from 
   DS_JOBOBJECTS, 
   DS_JOBS
where 
   DS_JOBOBJECTS.OLETYPE in ('CHashedOutput','CHashedInput') 
   and DS_JOBOBJECTS.OBJIDNO = DS_JOBS.JOBNO 
group by 
   FILE_NAME, 
   JOB_NAME,
   LINK_NAME
;

Code: Select all

select 
   CATEGORY, 
   COUNT(*)
from 
   DS_JOBOBJECTS, 
   DS_JOBS
where 
   DS_JOBOBJECTS.OLETYPE in ('CHashedOutput','CHashedInput') 
   and EVAL DS_JOBOBJECTS."@RECORD<6>" <> ''
   and DS_JOBOBJECTS.OBJIDNO = DS_JOBS.JOBNO 
group by 
   CATEGORY
;
Mamu Kim
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Post by Andal »

Hi All

Thanks for ur suggestions, The query given by Kim returns me entire rowcount of a category which doesnt satisfy my requirement.

So i looped a sequence and passed the Hashfile name as a input to my server job, and i got my required output. Thanks for all for spending ur valuable time.

Rgds
Andal
Titto
Participant
Posts: 148
Joined: Tue Jun 21, 2005 7:49 am

Post by Titto »

Can you post the code please
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Post by Andal »

Titto wrote:Can you post the code please
The query given by kim will return all the Hash file names.Loop it and then use

Code: Select all

SELECT Count(*), '#HashName#' FROM #HashName#;
and write it to a Sequential file.

My approach at that time was different. any how if you want the code, tell me ur mail id. I will send u the dsx.
Rgds
Anand
kkreddy
Participant
Posts: 28
Joined: Tue May 10, 2005 6:00 am

i too need

Post by kkreddy »

hi Andal
i too need the code , could u plz send it to kkreddy29@gmail.com

thanks and regards
Kiran Kumar
Titto
Participant
Posts: 148
Joined: Tue Jun 21, 2005 7:49 am

Post by Titto »

Andal wrote:
Titto wrote:Can you post the code please
The query given by kim will return all the Hash file names.Loop it and then use

Code: Select all

SELECT Count(*), '#HashName#' FROM #HashName#;
and write it to a Sequential file.

My approach at that time was different. any how if you want the code, tell me ur mail id. I will send u the dsx.
Please send it to raj_titto@yahoo.com
Thanks
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Post it. We helped you then help others by posting the solution.
Mamu Kim
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Post by Andal »

I had sent the DSX to the mentioned id's, or is there any site so that we can share our files. I will upload my DSX to the site so that everyone can access.

Anyhow this was written when i am new to DS, but now there are better ways to do it.
Rgds
Anand
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

It is all job control code correct? If so then post that. You could post the DSX on ADN (Ascential Developer Net).
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

:idea: You can even post the job control code here, surrounded by Code tags.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply