Trim in 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

karthegx
Participant
Posts: 27
Joined: Wed Sep 06, 2006 1:48 am

Trim in Modify stage

Post by karthegx »

HI ,

Can any one tell me abt the syntax to use in Modify stage for Trim function.

Thanks in Advance
kartheek
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

That wil be string_trim()

You have posted in the wrong forum.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
karthegx
Participant
Posts: 27
Joined: Wed Sep 06, 2006 1:48 am

Post by karthegx »

This syntax is enough for removing all leading and trailing spaces.
kartheek
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is your copy of Parallel Job Developer's Guide broken?
:roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Not sure if this is in Parallel Job Developer's Guide. This is the syntax :

Code: Select all

string_trim[character,direction,justify](string) 
This function can be used to trim occurrences of a character from the beginning or end of a string.
Ex:

Code: Select all

string_trim[" "](string)   --> Will trim all trailing spaces
string_trim[" ",begin](string)   --> Will trim all leading spaces
But you cannot trim both leading and trailing spaces using this function.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Good catch. However it IS in the Orchestrate Operators guide. Page 13-19 in the version 7.5 manual. Curiously, string_trim does not appear in the version 7.0 Orchestrate Operators guide.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
karthegx
Participant
Posts: 27
Joined: Wed Sep 06, 2006 1:48 am

Post by karthegx »

Can any one send me Orchestrate Operators guide 7.5 version

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

Post by ray.wurlod »

You support provider can supply the Orchestrate manuals at no charge for the asking.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
manishk
Participant
Posts: 32
Joined: Tue Oct 25, 2005 8:45 pm

Post by manishk »

Seems the Trim functions doesnt work in the modify Stage. i tried the option in Orchestrate manual and also tried the one given here , but it is not triming the spaces.

I used string_trim() and also tried with strip_whitespace () and trim_leading_trailing command. it doesnt work

Please let me know if there is anything different.

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

Post by ray.wurlod »

Please provide the exact syntax you used for string_trim(). It works OK for me on version 7.5.1A on Linux.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
manishk
Participant
Posts: 32
Joined: Tue Oct 25, 2005 8:45 pm

Post by manishk »

Here is my data in column n1 :

"Hello World"
and " Hello "

Here is my syntax :

1 . n3 : string = string_trim (n1)
2. n3 : string = strip_whitespace(n1)
3. n3 : string = trim_leading_trailing(n1)

This is not stripping the white spaces.

Data stage is running on AIX 3 5

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

Post by ray.wurlod »

I wonder if it's because of the unbounded string specification of the data type. Try

Code: Select all

n3:string[max=20] = string_trim[" ",end,begin](n1)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

I copied a bunch of Modify Stage code from the DataStage and Orchestrate guides into this wiki. Sh, don't tell IBM. The string_trim is in there. Was thinking it would be a good place to add sample code but never got around to it. Feel free to modify it.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's as complete a list of Modify stage functions as I've been able to construct here
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Meera
Premium Member
Premium Member
Posts: 21
Joined: Mon Nov 28, 2005 8:42 pm

Post by Meera »

Thanks Ray. The List of Modify stage functions pdf which you send is very helpful. I was looking at the 7.0 orchestrate manual for the string_trim and couldnt find it and then browsed the forum. This list helps.
Post Reply