instr in datastage

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
deeplind07
Participant
Posts: 31
Joined: Mon Jun 28, 2010 5:15 am
Location: pune

instr in datastage

Post by deeplind07 »

Hi,

Can some one tell me how can i search a substring from behind,(i want to search for the 1st space from the end of a string)
E.g. i want to split a note of more than 100 characters into 40 chars each. While doing so i want logically split the note, that means instead of truncating at the 40th Char i want to trunacte till the last space in the 40 cars

input String = 'Can someone tell me how can i search a substring from behind'
i want the first 40 chars until the last space
Expected output= 'Can someone tell me how can i search a '
I dont want 'Can someone tell me how can i search a s'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

By far the easiest way to accomplish this task is to use "text formatting", to do which you need to use the Fmt() function in a BASIC Transformer stage (or in a server job).
The derivation expression is

Code: Select all

Field(Fmt(InLink.TheString,"40T"),@TM,1,1)
The Fmt() function with "T" in its second argument produces a dynamic array delimited by text marks (@TM) containing substrings of not more than the specified length, broken on word boundaries. So if you need the other 40-character-or-less substrings, simply change the third argument of the encapsulating Field() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
deeplind07
Participant
Posts: 31
Joined: Mon Jun 28, 2010 5:15 am
Location: pune

Post by deeplind07 »

i cannot find the FMT() function in my designer
ssreeni3
Participant
Posts: 29
Joined: Fri May 18, 2012 1:35 am

Post by ssreeni3 »

Hi deeplind,

That function is available in BasicTransformer stage.

---------------------------------------------------------------------------------
Sreeni
rohitagarwal15
Participant
Posts: 102
Joined: Thu Sep 17, 2009 1:23 am

instr in datastage

Post by rohitagarwal15 »

BASIC transformer is not visible in the Proccesing palette in Parallel job. Hence we would need to bring in the BASIC transformer to our design canvas following the steps stated below:
Go to Repository tree -> Stages Types -> Parallel -> Processing -> BASIC Transformer.
Drag and drop the BASIC transformer stage to our design canvas.
Rohit
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

I wrote a Parallel Routine tro do a similar task - search for pxStrFirstCharList for the version that finds the first occurrence of a character in a set of characters, it should be easy to create a version that finds the last, I did make one but I don't have the source for that to hand.
Phil Hibbs | Capgemini
Technical Consultant
Post Reply