Compare Stage

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
psriva
Participant
Posts: 44
Joined: Fri Aug 11, 2006 8:40 am

Compare Stage

Post by psriva »

Can someone please guide me on using a compare stage?
ps
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
psriva
Participant
Posts: 44
Joined: Fri Aug 11, 2006 8:40 am

Post 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.
ps
psriva
Participant
Posts: 44
Joined: Fri Aug 11, 2006 8:40 am

Post 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?
ps
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
psriva
Participant
Posts: 44
Joined: Fri Aug 11, 2006 8:40 am

Post 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.)
ps
umamahes
Premium Member
Premium Member
Posts: 110
Joined: Tue Jul 04, 2006 9:08 pm

Post 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
HI
psriva
Participant
Posts: 44
Joined: Fri Aug 11, 2006 8:40 am

Post 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.
ps
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post 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.
Ultramundane
Participant
Posts: 407
Joined: Mon Jun 27, 2005 8:54 am
Location: Walker, Michigan
Contact:

Post 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.
Post Reply