To find record count

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
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

To find record count

Post by kumar66 »

Hi All,

I need to matrch the reocrd count of the trailer and the detail records.

The trailer has the field TotalCount . But the total count has the count of header row , Detail Rows and trailer roes.

For eg ;

The header has 1 row .
The Detail has 5 rows
The tralier has 1 row.

The total count in tralier will have 7 rows.

I need to match the count with the tralier .

Please advise.

Thanks & Regards,
Kumar.R
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Pre-process the file in an Execute Command activity executing the command wc -l filename

Read the last line of the file using tail -1 filename

Compare using test command.

Decide, on this basis, whether or not to run the job or to report a row count reconciliation error.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tsn
Participant
Posts: 51
Joined: Wed Jan 10, 2007 1:32 am

Post by tsn »

If your footer record count does not include the header record and footer record then wc-l output has to be subtracted with 2. as per you example the detail is 5 records only. if the footer has the record count as 5, wc-l will return 7, do 7-2=5.
with regards,
tsn
tsn
Participant
Posts: 51
Joined: Wed Jan 10, 2007 1:32 am

Post by tsn »

normally the source file record count would not include the header and footer. If it is not include then do 7-5 else you can go ith 7 itself.
with regards,
tsn
Post Reply