looping

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
talsahota
Charter Member
Charter Member
Posts: 13
Joined: Thu Nov 06, 2003 3:02 am

looping

Post by talsahota »

Hi all,

i have a file/table that holds 2columns OldPolicy,NewPolicy
eg:
OldPolid , NewPolid
AA , AB
AB , AC
AC , AD

BA , BB
BB , BC

AA became AB,AB became AC, AC became AD.The net result is that AA became AD and similarly BA became BC . I need to reflect this as:
OldPolid , NewPolid
AA , AD
BA , BC

Is it best to do this using stage variables.I would be grateful for any suggestions.
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Re: looping

Post by raju_chvr »

Did u give it a try with stage variables and RowProcGetPreviousValue() ?

I think that should work. In the constraints you should have a condition

RowProcGetPreviousValue(NewPolid) <> OldPolid

to write into output.

IHTH
talsahota
Charter Member
Charter Member
Posts: 13
Joined: Thu Nov 06, 2003 3:02 am

Re: looping

Post by talsahota »

raju_chvr wrote:Did u give it a try with stage variables and RowProcGetPreviousValue() ?

I think that should work. In the constraints you should have a condition

RowProcGetPreviousValue(NewPolid) <> OldPolid

to write into output.

IHTH

This didnt work, any ideas why or other methods, thanks in advance
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Re: looping

Post by ogmios »

If the input data is not too big the easiest would be to write a small BASIC DataStage job to cover your required functionality.

Ogmios
raju_chvr
Premium Member
Premium Member
Posts: 165
Joined: Sat Sep 27, 2003 9:19 am
Location: USA

Re: looping

Post by raju_chvr »

Can you post the cariables and their derivation you are using ? for this ..

I will talk a look into it.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Use stage variables. It is easier to understand. Do a search. This has been covered in viewtopic.php?t=84848
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you do something like the following:

Code: Select all

SELECT SUBSTR(OldID,1,1) AS FirstChar, MIN(OldID), MAX(NewID)
 FROM tablename
 GROUP BY FirstChar;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply