How to handle delimiter value at field level?

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
dssiddu
Participant
Posts: 66
Joined: Mon Nov 07, 2005 10:28 pm
Contact:

How to handle delimiter value at field level?

Post by dssiddu »

Hi DSsss
Input is as below, with pipe delimiter. But In location field value there is chance of comming | as one of the character in the values. I want to pass as it is to target. I want to do this in sequential file stage only (no Tmf allowed)

Please suggest
Input
NUM|LOCATION|STATECODE
10|MUM|BAI|MH
11|BANGALORE|KA
12|HYDRABAD|AP
13|CHENNAI|TN

Requeired Output as below

NUM LOCATION STATECODE
10 MUM|BAI MH
11 BANGALORE KA
12 HYDRABAD AP
13 CHENNAI TN

Thanks in advance... :roll:
mahadev.v
Participant
Posts: 111
Joined: Tue May 06, 2008 5:29 am
Location: Bangalore

Post by mahadev.v »

Using sequential file stage alone, its not possible. You can, at the most reject all the records with extra delimiter from the Sequential file stage and continue processing the other records.
"given enough eyeballs, all bugs are shallow" - Eric S. Raymond
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In order to do that, your string value would need to be quoted otherwise your file is invalid.

10|"MUM|BAI"|MH

Would read correctly. Otherwise you'd need to read it as a single string and then (attempt to) intelligently parse out the fields in a transformer.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply