Generate Sequence

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
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Generate Sequence

Post by shrey3a »

Hi,

I've a Scenario where I need to know the maximum number of sequnce number and then insert the new rows starting +1 of max sequenc number.

I've made a job in which I stored the max number of sequence in the has h file by:

SELECT MAX(USER_ID) FROM TFT_HR

Now In my second job I'm using the same hash file value and storing max value in stage variable 'SeqA' and defining another variable SeqB = SeqA +1 but I'm not getting the desired o/p . suppose the max number is 4325 and my result is value '4326' in all the column , I need the number to be incremented for each column.

Thanks in Advance.

Regards
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

SeqA + @INROWNUM
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Do you really mean for each column? Or each row?

If "each row" then Craig's solution, and yours (if in stage variables), will work.
Otherwise, you need a separate stage variable for each column, and one that updates the driver stage variable by the number of columns in the row.
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