make_null and substring in modify stage.

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
iwin
Premium Member
Premium Member
Posts: 99
Joined: Mon Apr 11, 2005 9:20 pm

make_null and substring in modify stage.

Post by iwin »

Hi,
Can anyone give example of how to use make_null() (replacing @null in server)and substring(replacing trim in server) in modify stage. I tried using them with following examples but its not working:

specification= new column=make_null()
specification= new column=substring[0,7](old column)

thanks in advance.
Every person you meet knows something you don't, Learn from them.
-- H. Jackson Brown
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Code: Select all

IN_COL = make_null(OUT_COL)

This will replace the @null value in your source column. But i prefer using handle_null in conjuction with make_null to perform this, so as to convert it to '0' or any specific value.

IN_COL=handle_null(make_null(OUT_COL),0)

relatively your second function has to be something like this..

Code: Select all


IN_COL = substring[1,7](OUT_COL)

which extracts the first seven characters of the field OUT_COL
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Code: Select all

IN_COL = make_null(OUT_COL)

This will replace the @null value in your source column. But i prefer using handle_null in conjuction with make_null to perform this, so as to convert it to '0' or any specific value.

IN_COL=handle_null(make_null(OUT_COL),0)

relatively your second function has to be something like this..

Code: Select all


IN_COL = substring[1,7](OUT_COL)

which extracts the first seven characters of the field OUT_COL
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
iwin
Premium Member
Premium Member
Posts: 99
Joined: Mon Apr 11, 2005 9:20 pm

Post by iwin »

Hey,
Thanks for reply. But the first one ( make_null) doesnt have an input column. @null in server is assigned in transformer when there is no input column present. Which contradictions what u r just said in modify stage make_null(input colum_name). Handle null is used to null the traget value if we have a null source value coming.
And coming to the 2nd question abt substring, the actual value pointer for substring starts with '0' not from '1'.

let me know if i missed something.

Thanks
Every person you meet knows something you don't, Learn from them.
-- H. Jackson Brown
Post Reply