Remove new line character from modify 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
Sagnik Mukherjee
Participant
Posts: 14
Joined: Wed Jul 25, 2012 5:29 am
Location: Mumbai

Remove new line character from modify stage

Post by Sagnik Mukherjee »

Hi,
I am using modify stage in a multiinstance job.Now in one field of the input file I get a new line character. For example - suppose the field name is 'ADDRESS1' and the data is populating like 'SOUDI ARAB'.
Now in between SOUDI and ARAB there is a new line character(not space).For that we are not getting correct data in output.

Now my question is how can we remove or trim new line character from modify stage.
Sagnik
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I have to admit that I use the modify stage less and less over time. There is no reason not to use a transform stage and the CONVERT() function to solve this problem.
Sagnik Mukherjee
Participant
Posts: 14
Joined: Wed Jul 25, 2012 5:29 am
Location: Mumbai

Post by Sagnik Mukherjee »

Actually I am using a multiinstance job. I have done all the transformation in modifyspec of modify stage.I cant use convert function in transformer as I pass everything at runtime.So I have to do it in modify stage only.
Please suggest.
Sagnik
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In this case multi-instance jobs play no role.

If you can do it in a modify stage, then you can do it in a transform stage. Is the column name in question a known one or are you passing the name in as a parameter?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

To answer the original question, the required Modify stage function is string_trim()
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sagnik Mukherjee
Participant
Posts: 14
Joined: Wed Jul 25, 2012 5:29 am
Location: Mumbai

Post by Sagnik Mukherjee »

Sorry for my late reply.

Now I am using this :

AD_LINE_1_TX:string[max=40]=string_trim(AD_LINE_1_TX,"\n");

where AD_LINE_1_TX is th column name.

But it gives an error.

main_program: Error parsing modify adapter: Error in binding: Expected ')', got: ","
Expected destination field selector, got: ")"; input:
drop D,TS1,TS2,TS3,TS4,TIMESTAMP1,DATE1;MER_STRT_DT=D1;MER_END_DT=D2;AD_LINE_1_TX:string[max=40]=string_trim(AD_LINE_1_TX,"
");[/
b]NOWARN

please suggest..
Sagnik
Sagnik Mukherjee
Participant
Posts: 14
Joined: Wed Jul 25, 2012 5:29 am
Location: Mumbai

Post by Sagnik Mukherjee »

Now I am using this :

AD_LINE_1_TX:string[max=40]=string_trim["\n"](AD_LINE_1_TX)

and its working fine..

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

Post by ray.wurlod »

So you didn't really need to send me a PM asking me to look at this.
:x

I do not spend 24/7 logged in to DSXchange. Indeed, I probably only devote about 1 hour per day, maybe less on weekends.
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