Page 1 of 1

switch stage

Posted: Thu Jan 03, 2008 6:39 pm
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

Posted: Thu Jan 03, 2008 8:24 pm
by chulett
Why not just substring the first character and check that?

switch stage

Posted: Thu Jan 03, 2008 8:32 pm
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.

Posted: Thu Jan 03, 2008 9:18 pm
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.

switch stage

Posted: Fri Jan 04, 2008 11:47 pm
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.