problem with LINKROWCOUNT

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

Post Reply
mac4rfree85
Participant
Posts: 126
Joined: Thu Jul 01, 2010 11:39 pm

problem with LINKROWCOUNT

Post by mac4rfree85 »

Hi,

I am trying to get the rowcount of the records from a flat file.

Design

Flatfile ---> Transformer ---> Flatfile

In transformer, am creating a new field which will contain the count of the records in the flatfile. The expression i am using is as below

Code: Select all

DSGetLinkInfo(DSJ.ME,"Jobname","Flatfile_Stagename",DSJ.LINKROWCOUNT)
I am getting only "0" as the rowcount. But it should be 11 and the job is running fine without throwing an error.

Thanks for your help in advance.

Regards,
Magesh
Mac4rfree
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There are 2 problems with your code.

Code: Select all

DSGetLinkInfo(DSJ.ME,"Flatfile_Stagename","Flatfile_Linkname",DSJ.LINKROWCOUNT)
The other problem is that this gets called for each row, so your first row value will be 1, the second row 2, etc. This would be more efficient by using @INROWNUM in a transform stage.

Why not use a filter command "wc -l" in your sequential file reading stage and you will get one row with one column containing just what you are looking for.
Post Reply