char(10) format

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

char(10) format

Post by Mark_E »

hi, i know this has been discussed many times before and i am using a previous example from this site that i searched on but i am getting quite odd results.

my source file is:

a|aa,bb,cc
b|
c|dd

the results i am getting is

a|aa
a|aa
b|
c|dd
c|dd

and i require

a|aa
a|bb
a|cc
b|
c|dd

probably something i am missing out, this is my job design:

stage variable

char(10) : svNewLine
"," : svFieldDelim

Output Columns

DSLink3.f1 : col1
DSLink3.f3 :svNewLine : DSLink3.f1 : svFieldDelim : DSLink3.f3 :col2

thanks again
mark_e
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Does your input file have 2 columns defined with a delimiter of "|"? If so, how do you get DSLink3.f3?
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

sorry, it has more but i'm just using two as an example here as i'm only bring two columns across in the transformer. once i had this working then i was going to build it up

thanks
mark_e
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

sorry, it has more but i'm just using two as an example here as i'm only bring two columns across in the transformer. once i had this working then i was going to build it up

thanks
mark_e
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

sorry, it has more but i'm just using two as an example here as i'm only bring two columns across in the transformer. once i had this working then i was going to build it up

thanks
mark_e
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

NewCol is derived as

Code: Select all

EReplace(",":DSLink3.f2,",",Char(10):DSLink3.f1:"|")
and no stage variables. This assumes that for line 1 f1 is "a" and f2 is "aa,bb,cc".
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

hi,

i tried that but got some odd results.

Output column

DSLink3.f1 : col1
EReplace(",":DSLink3.f2,",",Char(10):DSLink3.f1:"|") : col2

reults as

col1 : col2
a
a|aa
a|bb
a|cc
b
c|dd"


col2 is empty
mark_e
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

sorry, my mistake, i just needed to format the target file with pipe delimited. the output now is as follows :

col1 col2
a
a aa
a bb
a cc
b
c
c dd

so just need to emilinate the a and c that have col2 as blank somehow
mark_e
Post Reply