Count the rows in sequential/Complex file

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
ms294
Participant
Posts: 19
Joined: Thu Mar 25, 2010 1:36 pm

Count the rows in sequential/Complex file

Post by ms294 »

Does anybody know how to count the total number of row/records in a sequential or complex flat file using dataStage 7.5 ? Thanks!

mark
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Use aggregator and do count on any non-nullable field to get the row count
You are the creator of your destiny - Swami Vivekananda
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's certainly one way, it might be helpful to know how you need to use this count to see if there is a "better" way.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

For a sequential file with newline delimiter, a simple wc in unix and find in dos can get your answer.

For non-newline (but delimited) file, you can either locate those delimiters.

For fixed width, divide the file size by record length.
adisheshu.dwh
Participant
Posts: 12
Joined: Tue Aug 26, 2008 10:48 pm

Post by adisheshu.dwh »

in Unix u can use WC ,It can count total num of characters ,rows and num of lines and words

wc -c filename................count the characters
wc -l filename................count the num of lines
wc -w filename..............count the num of words
ADISHESHU.P
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

U (one of our other posters) did not ask the question, so why did you suggest that U could use the WC command?

That wouldn't work anyway. UNIX commands are case sensitive, and the correct command name in this case would be wc.

The second person personal pronoun in English is spelled "you". Try to maintain a professional standard of written English on DSXchange - it helps those whose first language is not English.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ms294
Participant
Posts: 19
Joined: Thu Mar 25, 2010 1:36 pm

Post by ms294 »

anbu wrote:Use aggregator and do count on any non-nullable field to get the row count
This did solve my problem. Thanks !
Post Reply