Issue in capturing string by positions in transformer 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
Nagasudheerkumar
Premium Member
Premium Member
Posts: 55
Joined: Tue Apr 24, 2007 1:26 am

Issue in capturing string by positions in transformer stage

Post by Nagasudheerkumar »

Hi,

I have a requirement while loading the file.

The below file is semicolon delimiter & Double quote for character fields.

I/p:
1000;12-11-2000;"";"ASDDIK";"R"
1001;12-12-2001;"";""TOMI"" ";"R"
1002;01-01-1982;"";"";""
1003;12-12-2001;"";"AYEHHE;JDJUE";"";"R"

Actual O/P:
1000;12-11-2000;;ASDDIK;;R
1001;12-12-2001;;""TOMI"" ;R
1002;01-01-1982;;;
1003;12-12-2001;;AYEHHE;JDJUE;;R

Present O/P:
1000;12-11-2000;;ASDDIK;;R
1001;12-12-2001;;""TOMI"" ;R;""TOMI"" ;R
1002;01-01-1982;;;;;
1003;12-12-2001;;AYEHHE;JDJUE;;RAYEHHE;JDJUE;;R

job Design:

Sequential file-->Tranformer stage(3outputs for 4th,5th and 6th delimeters)--->funnel--->Oracle Connector

Description: In sequential file, i am reading file as single column because the data has more delimiters. In transformer stage i am using staging variables for free text field(4th field) and taking the string between the delimter but it is working only for 1st row not for all the rows.

Datatype is Varchar2

stg1: Index(DSlink1.001,';',3)+2
stg2: Index(DSlink1.001,';',4)-1

in derivation field: DSlink1.001[stg1,stg2]

From second record i am not able see the desired output.
Index functions are working fine.
Can you please let me know any suggestions for this issue.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... which of these two is your "desired" output:

Actual O/P
Present O/P

Guessing the first (Actual) is what you desire and the second (Present) is what you are getting but would like to be sure before I lose too many brain-cells puzzling out more of this. :wink:
-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 »

Your logic is wrong, which is why things are repeating.

The simple solution would be to read each line as a single VarChar and to use a Convert() function to remove the double-quote characters.
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