cut up string

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
ziedkhouja
Participant
Posts: 5
Joined: Thu Oct 04, 2007 12:46 am

cut up string

Post by ziedkhouja »

Hi Everybody,

I want to cut up a string displayed in 38 characters into three parts
8,10 and 10
what i can use as transformations to do this

Thank you very much.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.
8 + 10 + 10 is only 28; what do you want to do with the other ten characters?
You can use the Left(string,n) function to get the leftmost n characters from a string, the Right(string,n) function to get the rightmost n characters from a string, and Substrings(string,start,length) or - equivalently - string[start,length] to extract an arbitrary substring.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ziedkhouja
Participant
Posts: 5
Joined: Thu Oct 04, 2007 12:46 am

Post by ziedkhouja »

Sorry 8,10,10 and 10 characters
I try the syntax string [ [ start, ] length ]
but i receive an error:

Compiling: Source = 'RT_BP15/JOB.427335405.DT.1452632587.TRANS1', Object = 'RT_BP15.O/JOB.427335405.DT.1452632587.TRANS1'
**********************************************************************************************************************
WARNING: Variable 'substring' never assigned a value.

Compilation Complete.
(Simulation1.Transformer_4)
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Check your syntax:

Code: Select all

string [ start, length ]
ziedkhouja wrote: I try the syntax string [ [ start, ] length ]
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 »

The name of the function is Substrings (with a final "s"). You left this off, so DataStage is looking for a variable called Substring.
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