SubStr Function

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
sampitke1
Participant
Posts: 24
Joined: Mon Apr 28, 2008 4:22 pm

SubStr Function

Post by sampitke1 »

Hi

Can you please let me know which function in DataStage is like SUBSTR function in ORACLE?

Requirement: Source and Target is Sequential File

Input Data : 123456.1234578
Output Data: 456.12

Logic Cut String from 4th Character to 10th Character (including Decimal)

Can you please let me know how can I achieve this in DataStage?

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

Post by ray.wurlod »

It's done with square bracket notation if you are using a Transformer stage. Syntax is string[start,length] so, in your case,

Code: Select all

InLink.TheString[4,6]
There is also a substring function for the Modify stage if you are preferring to use that. Beware, though, that counting in the Modify stage is zero-based whereas in the Transformer stage it is one-based.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sampitke1
Participant
Posts: 24
Joined: Mon Apr 28, 2008 4:22 pm

SubStr : Cut String

Post by sampitke1 »

Thanks Ray.I tried the String Function however it is not working.
I am not able to see your email completely.

Please let me know if there is any function / workaround for this.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There's no "string" function - you use the square brackets with your string field to substring it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sampitke1
Participant
Posts: 24
Joined: Mon Apr 28, 2008 4:22 pm

Post by sampitke1 »

Thanks chulett for your reply. This challenge has been resolved now.
sampitke1
Participant
Posts: 24
Joined: Mon Apr 28, 2008 4:22 pm

Post by sampitke1 »

Thanks chulett for your reply. This challenge has been resolved now.
Post Reply