split one record to multiple records and field delemeter &qu

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
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

split one record to multiple records and field delemeter &qu

Post by vinodn »

Hi,

My input record is given below

"name","desig","description"=======Column names

"raghunath","software","software,engineerfromindia" ===== Data

My Requirement is given below,

1) need to check the delemeters(",") count , if it is fine then process the record, otherwise abort the job and send mail to source system

Here comma is coming within the data so delemeter is coming as ","

i am unable to find the count by using the count function in datastage for the delemeter(",")

2)need to split the above record into 3 records and write the records into one output file

output as

raghunath
software
software,engineerfromindia




and one more thing is i need to check the description column, if the lenth is greaterthan 3, need split the description column(max 3 charecters)

output as

raghunath
software
sof
twa
re,
eng
ine
erf
rom
ind
ia


Can you please give the suggestion,

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

Post by ArndW »

The first problem isn't too tough, you need to apply the rule as

the first and last characters must be double-quotes and the internal delimiters must be '","'. This can be done with simple left(), right(), and count functions in your transform logic.

Once you have that solved, you can look up "pivot"
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

split one record to multiple records and field delemeter &qu

Post by vinodn »

Thanks for your's suggestion,

Pivot is not the solution, because i need to write the records into the target output file

Job reads the first record from the file and first 3 columns write into the ouput file as first record and next 3 columns write into the same target file as second record and so on,

Next job reads second record from the source file and process the same as above

Is it work char(10) in transformer satge for new line
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

split one record to multiple records and field delemeter &qu

Post by vinodn »

Thanks for your's suggestion,

Pivot is not the solution, because i need to write the records into the target output file

Job reads the first record from the file and first 3 columns write into the ouput file as first record and next 3 columns write into the same target file as second record and so on,

Next job reads second record from the source file and process the same as above

Is it work char(10) in transformer satge for new line
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: split one record to multiple records and field delemeter

Post by chulett »

vinodn wrote:Pivot is not the solution, because i need to write the records into the target output file
Not sure what the relevance is here, one to the other. :?
vinodn also wrote:Job reads the first record from the file and first 3 columns write into the output file as first record and next 3 columns write into the same target file as second record and so on
In other words, a pivot of columns to rows. Perhaps a little Abby Normal but a pivot nonetheless.
-craig

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