logic on group number

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
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

logic on group number

Post by dodda »

Hello

I have a requirement where i need to read the data from seq file and write it to a seq file. i am using transformer and running the transformer sequentially.

I am using a job parameter called group number. If the group number is 4 then i need to create additional column called group number and assin the values as below.

lets say i am extracting 10 rows from input file (a,b,c,d....). The out out should be

Col1 GroupNbr
a 1
b 1
c 1
d 1
e 2
f 2
g 2
h 2
i 3
j 3

and so on.

Need help on how to get this grp numbers. This group number parametr i am passing as a job parameter and this can be any number.




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

Post by chulett »

Yet another chance to use stage variables to control that, something very similar to what was just posted here I would wager:

viewtopic.php?t=135971
-craig

"You can never have too many knives" -- Logan Nine Fingers
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Post by dodda »

hello chulett,

This is different logic i have to assign one disticnt number for every 4 rows and there is no identifer to differentiate the change of value from the input stream

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

Post by chulett »

It's not all *that* different, you simply reset on a count rather than a key change.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Post by dodda »

i accomplished it by dividing the rownum with the job parameter and applying ciel function.

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

Post by chulett »

That sounds like one solution, a Mod() would have worked as well, I would think. Or a simple counter checking against the parameter value. As usual, more than one way to skin the cat. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
agpt
Participant
Posts: 151
Joined: Sun May 16, 2010 12:53 am

Post by agpt »

dodda wrote:i accomplished it by dividing the rownum with the job parameter and applying ciel function.

Thanks
Can you please tell how exactly you assigned one number to 4 conscutive rows?
Post Reply