SEQFILE

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
pandu80
Participant
Posts: 50
Joined: Fri Apr 08, 2005 5:56 pm

SEQFILE

Post by pandu80 »

Hi
I have sequential file with customerid,supplierid and Lookuphas file with
customerid and profit percentage.

SEQFILE
cus_id Supp_id
100 001


Hsh_file
cus_id Profit%
100 10
101 20

If the customerd is equal then based on the percentage i need to create one record with 10%
and one with 90%. So my target will be

cus_id Supp_id
100 001
100 002

How can i achieve this?.

Kindly throw some light on this.

TIA.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Do a lookup to the hash file and compute the value in a transform. Write to the target db in 2 links.
pandu80
Participant
Posts: 50
Joined: Fri Apr 08, 2005 5:56 pm

Post by pandu80 »

Hi,

Code: Select all

                       
                                    ----------------SEQ_FILE(WITH 90%RECORDS)
                                    |
                                    |
 SEQ_FILE-------------->XFM------------->SEQ_FILE(WITH 10 % RECORDS)
                                   ^
                                    |
                                    |LOOKUP_HSH

I AM GIVING THE CONSTRAINT AS "NOT(SPLIT PERCENTAGE)=0" GOTO THE RECORDS TO SEQ_FILE(WITH 90%).

IF MY SOURCE SEQ_FILE HAS 2 SAME RECORDS ,SPLITTING IS APPLIES ONLY THE SECOND RECORD.IF I HAVE 4 SAME RECORDS IT APPLIES TO LAST 3 RECORDS.
MY CODE IN STAGE VARIABLE svProfPercentage

IF INPUT.CUST_ID=HSH_CUST_ID THEN HSH_PROFIT Else 0


TIA
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No problem, set up your output constraints to take the extra condition into account.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

From what you are saying, it appears that given n record, you want your logic to be applied for the last n-1 records (i.e. not the first record). What if you have only one?
Post Reply