Page 1 of 1

Compare Stage

Posted: Wed Mar 21, 2007 12:22 pm
by psriva
Can someone please guide me on using a compare stage?

Posted: Wed Mar 21, 2007 12:24 pm
by DSguru2B
Sure. You will find posts for your guidance. Have you tried searching. Did you go through Parallel developer's guide. That will be of most help.

Posted: Wed Mar 21, 2007 12:34 pm
by psriva
Yes, I am looking into the posts but am finidng nothing that is helping. I am looking through the Parallel Developers Guide and I find it a little confusing.
For eg. I have a file with account_no and name columns which I want to compare against another file which has the same 2 columns.

Do I need to specify a key column and in the output file what should the metadata look like?

Thanks.

Posted: Wed Mar 21, 2007 3:21 pm
by psriva
I put together a job wherein I read 2 sequential files and pass them through a Cmpare stage and outputs to a sequntial file.

Input file -1 and 2 (have the same col's)
lname
fname
initial (key)

Output file is defined as such:
first.lname
first.fname
first.initial
second.lname
second.fname
second.initial

I get an error as follows:
In field "first": Expected ";", got: ".", line 45
In field "first": Expected ";", got: ".", line 46
In field "second": Expected ";", got: ".", line 47
In field "second": Expected ";", got: ".", line 48
In field "second": Expected ";", got: ".", line 49

Can someone explain this error, please?

Posted: Wed Mar 21, 2007 4:18 pm
by DSguru2B
Replace the dot(.) in the column name with an underscore and see if the error goes away. Also, I believe the output requires an extra column which tells you what column changed. Look into the DS help for the stage.

Posted: Wed Mar 21, 2007 6:27 pm
by ray.wurlod
Compare stage only compares columns identified as Key.

Also, you will need a column called diff on the output, to receive the result. The output from a Compare stage consists of three columns, diff, the first input link record as a subrecord, and the other input link record as a subrecord.

The Compare stage expects inputs to be partitioned and sorted on these keys.

Posted: Mon Mar 26, 2007 3:44 pm
by psriva
Added another column to hold the result but still I get the same error saying expected ';' and got '.'

(FYI:By the way if I replace the dot with an underscore then I get an altogether different error saying that it did not find the column name.)

Posted: Mon Mar 26, 2007 4:47 pm
by umamahes
HI,

Use a schema file (RCP) and specify a key column in the compare stage which you want to do comparision.It should work.

Thanks
Uma

Posted: Tue Mar 27, 2007 8:51 am
by psriva
I tried using the schema file with RCP settings and also specified the key column in the compare stage but still I get the same error.

Posted: Tue May 15, 2007 2:48 pm
by splayer
psriva, were you able to find a solution to this problem? I am getting the same error. Also, if I want to specifically specify column widths and names, how do I do it? I am always getting an error.

Posted: Tue May 15, 2007 2:52 pm
by Ultramundane
The compare stage outputs its data as a subrecord. In order to read it (unpack the records) you must use a promote subrecord stage as target of the compare stage.