modify function substring()

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
emma
Premium Member
Premium Member
Posts: 95
Joined: Fri Aug 08, 2003 10:30 am
Location: Montreal

modify function substring()

Post by emma »

I want to use a modify stage (because I don't want to use transformer) to split a single fixed field in two fields.
Like specifications I have to extract from the input string two strings to the output

record_type:string[1] = substring(record_data,1,1) ;
record_detail:string[255] = substring(record_data,2,255) ;

And I have this message:

Error parsing modify adapter: Error in binding:
Parsing parameters "" for conversion "string=substring [0,0](string)": Expected integer, got: <eof>
Expected destination field selector, got: ")"; input:
record_type:string[1] = substring(record_data,1,1)

Something wrong with the syntax or the modify stage is not capable to accomplish this kind of transformation?
Thanks,
Emma
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Try
record_type:string[1] = substring[1,1](record_data)
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
emma
Premium Member
Premium Member
Posts: 95
Joined: Fri Aug 08, 2003 10:30 am
Location: Montreal

Post by emma »

Thanks Kumar_s.

It works if we keep in mind that in Orchestrate environment a string starts with 0 not with 1 like in BASIC.
So, to extract first character must be:
record_type:string[1] = substring[0,1](record_data)
Thanks,
Emma
benny.lbs
Participant
Posts: 125
Joined: Wed Feb 23, 2005 3:46 am

Post by benny.lbs »

emma wrote:Thanks Kumar_s.

It works if we keep in mind that in Orchestrate environment a string starts with 0 not with 1 like in BASIC.
So, to extract first character must be:
record_type:string[1] = substring[0,1](record_data)
Just for document, In Transformer, it starts with 1.
Post Reply