Substring extraction

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
elavenil
Premium Member
Premium Member
Posts: 467
Joined: Thu Jan 31, 2002 10:20 pm
Location: Singapore

Substring extraction

Post by elavenil »

Trying to extract 1st 2 chars from a string but the job got aborted with the error message "Error parsing modify adapter: Error in binding: Expected source field selector; got: "20070705"
Expected destination field selector, got: ")"; input:"
and the code that is applied in Modify stage, is below.

MISTR:string[2] = substring[1,2] (#BIZDATE#), where BIZDATE is the parameter and '20070705' was passed while executing the job.

Let me know what is wrong and whether parameter can be used in the derivation.

Thanks
Elavenil
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Check your substring syntax in the online help or pdf documentation.
-craig

"You can never have too many knives" -- Logan Nine Fingers
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?
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>
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

JoshGeorge wrote:Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?
Check the type of your parameter in its definition. May be it is other than a string.
gateleys
Abburi
Participant
Posts: 31
Joined: Tue May 29, 2007 12:38 pm

Post by Abburi »

gateleys wrote:
JoshGeorge wrote:Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?
Check the type of your parameter in its definition. May be it is other than a string.
Use the square brackets. They are perfectly viable solution for substrings in both server and parallel editions

More you can find from below link, which DSguru2B has posted.

viewtopic.php?t=111106&highlight=substring
Regards,
Abburi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Abburi, you are thinking of the Transformer stage, not the Modify stage.

Elavenil, in another post I discussed the inviability of using job parameters in Modify stage.
Note also that the Modify stage positional argument is zero based, therefore the first two characters in a string are 0 and 1. So you would need

Code: Select all

MISTR:string[2] = substring[0,2](BIZDATE) 
where BIZDATE is the name of the input column generated upstream from the Modify stage, using a job parameter reference perhaps in a Column Generator stage.
Last edited by ray.wurlod on Thu Sep 06, 2007 8:10 pm, edited 1 time in total.
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 »

Yeah, modify stage dosen't like job parameter substituted in its operator calls.
JoshGeorge wrote:Substring syntax looks alrite for me.
OutputField=substring [startPosition,len] (InputField)
or is this not the right syntax? :roll: Passing job parameter into that syntax can be the issue?[/quote]
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>
Post Reply