Page 1 of 1

Guide or tutorial to write Datastage Routines

Posted: Tue Aug 04, 2009 10:21 pm
by Network_CIS
Hi,
Could anybody help me with Guides or tutorials for writing and using Datastage routines.

Or could anybody suggest to do this without routines >
source: oracle
target: tab delimited sequential file

requirement:I need to break a line into two rows if text in a row is more than 132 chars.

col1: key value
col2: notes

if notes are longer than 132 then terget should look like:

key1<tab>notes1(1-132 chars)
key1<tab>notes1(133-265 chars)
key1<tab>notes1(266-531 chars)
.... so on

Regards,
Satish

Posted: Wed Aug 05, 2009 12:08 am
by ray.wurlod
You can use a server job or BASIC Transformer stage in a parallel job and the Fold() function or the Fmt() function in either.

Do you want to break at the exact character boundary, or preserve whole words on a single line? Both are possible.

Posted: Wed Aug 05, 2009 12:10 am
by ray.wurlod
For lines that will never be more than a small multiple of 132, you could also use substrings onto multiple outputs of a Transformer stage (constrain each with an expression that guarantees existence of that line fragment) and combine those with a Funnel stage.

Posted: Wed Aug 05, 2009 6:00 pm
by Network_CIS
Hi Ray,
Length in source data is variable could be anywhere between Empty to 4000 chars; however, target can only store 132 chars max for that column.

Could you please help me with a example of using either function, where I could still maintain following format.

'Key1<TAB>Note1'
'Key1<TAB>Note1'
'Key1<TAB>Note1'
'Key2<TAB>Note2'
'Key3<TAB>Note3'
'Key3<TAB>Note3'
.... so on

Regards,
Satish

Posted: Wed Aug 05, 2009 6:11 pm
by ray.wurlod
I'm sure if you Search on DSXchange you will be able to find some examples.

Posted: Wed Aug 05, 2009 7:50 pm
by Network_CIS