Making data run on multiple lines

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

Making data run on multiple lines

Post by Mark_E »

Hi,

I have a single 100 char field, and i have values that needs to go into this that can be greater than 100. if the values go over 100 char i need it to break on to the next line and so and so on.. grouping done via sortnum

ex. using a 10 char field

sortnum, text

01 Dstage Ser
01 ver
02 Posting ne
02 w topic

the text Dstage Server is carrying onto the next line as it hits the 10 char limit and same for sortnum 02

any thoughts most welcome. thanks in advance
mark_e
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Check this FAQ posting: viewtopic.php?t=88639

You can write out a single 'record' with record delimiters in all the right places such that, when the records are read back in, they break up into the pieces that you need.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

thank you, i shall have a look into that
mark_e
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

hi,

when i add other fields to the multiple lines question the format seems to go wrong, any ideas.

i.e. col1,col2

1, aaaaabbbbb

which i want to be

1 aaaaa
bbbbb

ends up as

1 aaaaa
bbbbb

thanks
mark_e
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not enough information. Please describe (with examples) the expressions you are using to accomplish this result.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

the data is as such
DSLink2.f1 = 1
DSLink2.f2 = aaaaabbbbb

my job contains:
stage var:
char(10) -- svSeparator
DSLink2.f2[6,5] -- svText

Derivation

DSLink2.f1 -- col1
DSLink2.f2[1,5] :svSeparator: svText -- col2


if i don't have the col1 in the target i get what i need
aaaaa
bbbbb

but if i put col1 in there i get a blank value in the 2nd row

aaaaa
bbbbb 1

how can i either get a duplicated 1 value or better still the 1 in the 1st row with a blank in the 2nd

aaaaa 1
bbbbb

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

Post by Mark_E »

sorry for the previous ex, the order in the derivation should have been col2, col1

if i do it as col1, col2

i get this:
1 aaaaa
bbbbb
mark_e
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

If you have a finite width, say 1000, then breaking every 100 chars means up to 10 possible output links from a Transformer into a Link Collector and stage variables that divide up the data. You could go for the solution posted that scales better, but this might just be easier.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to use 'code' tags to preserve spaces - your example made zero sense until I looked at what you originally posted.
Mark_E wrote:hi,

when i add other fields to the multiple lines question the format seems to go wrong, any ideas.

i.e. col1,col2

1, aaaaabbbbb

Code: Select all

which i want to be 

1 aaaaa
   bbbbb

ends up as 

1       aaaaa
bbbbb
thanks
You have complete control over what is getting output. There shouldn't be any reason you can't get what you want. If you want 'a blank in the second record' - add it.
the data is as such
DSLink2.f1 = 1
DSLink2.f2 = aaaaabbbbb

my job contains:
stage var:
char(10) -- svSeparator
DSLink2.f2[6,5] -- svText

Derivation

DSLink2.f1 -- col1
DSLink2.f2[1,5] :svSeparator: svText -- col2
What is your column delimiter, a comma? Why not try something like this...

Code: Select all

OutputLink: DSLink2.f2[1,5]:",":DSLink2.f1:svSeparator:DSLink2.f2[6,5]:","
Note the comma after the 'last' field. Write out this single 'field' to a flat file as one long varchar field.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

thanks again to all, for your advice, i shall give that a go.
mark_e
Mark_E
Premium Member
Premium Member
Posts: 72
Joined: Fri Jan 23, 2004 3:04 am

Post by Mark_E »

thanks again to all, for your advice, i shall give that a go.
mark_e
Post Reply