Page 1 of 1

looping

Posted: Tue Feb 10, 2004 9:08 am
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.

Re: looping

Posted: Tue Feb 10, 2004 9:45 am
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

Re: looping

Posted: Tue Feb 10, 2004 12:34 pm
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

Re: looping

Posted: Tue Feb 10, 2004 12:52 pm
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

Re: looping

Posted: Tue Feb 10, 2004 1:21 pm
by raju_chvr
Can you post the cariables and their derivation you are using ? for this ..

I will talk a look into it.

Posted: Tue Feb 10, 2004 1:54 pm
by kduke
Use stage variables. It is easier to understand. Do a search. This has been covered in viewtopic.php?t=84848

Posted: Tue Feb 10, 2004 3:15 pm
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;