Page 1 of 1

To find record count

Posted: Fri May 09, 2008 3:43 pm
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

Posted: Fri May 09, 2008 5:17 pm
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.

Posted: Mon May 12, 2008 12:53 am
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.

Posted: Mon May 12, 2008 1:03 am
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.