Page 1 of 1

Counting Number of Lines

Posted: Thu Feb 14, 2008 10:02 pm
by 199542
Hi ,
I have a requirement where I need to count number of lines in a flat file and store it in a variable ( say line_count ) .In the flat file , a trailer record will b present .In that Record , One field gives the count .If that count is equal to the line_count then the file is valid .

I can get value of line_count as follows using unix command .
line_count=`cat line_count | wc -l `

But I want it to b done in datastage . Is there any way to count number of lines in a file and store it in a variable .
From this forum , I came to know that it can b done through DSGetLinkInfo() function.
Can u plzz tell how to invoke that function ? Where to invoke that function ?
Can u plzz tell the detailed description of that as i am new to datastage .

Posted: Thu Feb 14, 2008 10:12 pm
by kcbland
It makes zero sense to make DataStage read a whole file just to count it. The unix command "wc -l yourfile" is faster and more efficient for such a simple task. The API you mentioned is used to query a job after it has run and get the link information (row count) for the logic branches within the job.

Re: Counting Number of Lines

Posted: Thu Feb 14, 2008 10:41 pm
by ray.wurlod
199542 wrote:Can u plzz tell how to invoke that function ? Where to invoke that function ?
Can u plzz tell the detailed description of that as i am new to datastage .
Here at DSXchange we value professional standards of written English, much as your employer doubtless expects you to use when documenting your work or developing specification.

You are NOT new to English, so please use correct spelling.

DSXchange is NOT a mobile telephone; many of the participants are not so familiar with English that SMS-style abbreviations make any sense.


The second person personal pronoun is "you".