switch stage

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
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

switch stage

Post by just4u_sharath »

HI.
Lets say i have 4 records
aaardtg
basertydfi
cdrefitjf
deryihlffg

There is only one column
point to note is first record start with a, second with b, third with c and last one with d. I read this data from a sequenctial file. Now i have to split this 4 records to 4 individual flat files such that record starting with a goes to first file, records that start with b goes to secodn file and so on. i tried to do this using a switch stage. but i couldnt figure out how to write the wildchar character( like a*, b*). Can you please tell me how can i move the records to individual files. All the records belong to a single column
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not just substring the first character and check that?
-craig

"You can never have too many knives" -- Logan Nine Fingers
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

switch stage

Post by just4u_sharath »

chulett wrote:Why not just substring the first character and check that?
I have tried that and its working. But the original job has lots of transformers in it. so i want to get rid of any transformers (i have used transformer to substring the first character) if i can. Is there any other solution using other stages like filter, switch. I will be happy if i can do this without xformer.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"They" did a lot of work with Transformers for version 7.5 - they now generate code that's quite close to an operator. The incentive to remove them is not as great as it once was.

There is no real alternative to taking the first character somewhere - the Switch stage does not have any computational capability. You could use a Filter stage, with a LIKE comparison.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

switch stage

Post by just4u_sharath »

ray.wurlod wrote:"They" did a lot of work with Transformers for version 7.5 - they now generate code that's quite close to an operator. The incentive to remove them is not as great as it once was.

There is no real alternative to taking the first character somewhere - the Switch stage does not have any computational capability. You could use a Filter stage, with a LIKE comparison.
Thanks Ray. That was a nice response. Really helped me.
Post Reply