Page 1 of 1

Compare the number of records

Posted: Wed Mar 26, 2008 3:29 am
by srini.dw
Hi,

I have 2 files CART input file and CART control file.

1. The CART input data file will have an number of rows.
Eg. VIS.DAT

CART control file will be having the told number of records present in CARTinput file.
Eg.. VIS.DAT 55000

Question: How to compare the number of records present in CART input data file & CART control file are equal.

Any ideas..

Thanks

Posted: Wed Mar 26, 2008 3:39 am
by Raghavendra
Can you please let me know what is CART input file & Control file?
Is CART some different file type?

Posted: Wed Mar 26, 2008 3:42 am
by srini.dw
Please ignore the word CART, take 1 input file and other Control file

Posted: Wed Mar 26, 2008 4:01 am
by ray.wurlod
In a word, beforehand. Or afterwards.

If beforehand, get the line count from the input file and compare it with the value in the control file. You can use operating system utilities to get both values, and compare them in a Nested Condition activity.

If afterwards you can compare one of the row counts captured by DataStage (presumably on the file-reading link) with the number in the control file. You can do this in an after-job subroutine, or back in the job sequence once the job has finished.

Posted: Wed Mar 26, 2008 4:02 am
by BugFree
So is this CART file a text file? You have a data file with the records and a control file with the data file name and record count. you want to cross check if the record counts match? Is that all?

Use an external source stage. "wc -l " will be the command followed by your data file path and name. Use a column generator and generate a dummy column with value, say 'A'. Now in another stream use a sequential file stage to read the control file, followed by a column generator again to generate a dummy column with the value 'A'. Join the two streams using a join stage. Now you have both the counts (control file count and the actual count). Compare them using a transformer.

Posted: Wed Mar 26, 2008 4:30 am
by srini.dw
I will check with option provided and come back if it works, Thanks for the information provided