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
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Modify Stage

Post by DS_MJ »

Hello All:

Want to use the Modify stage for type conversion and length conversion.

1 - Trying to convert a CHAR 5 field to a SMALLINT 5.

Am able to successfully modify null values and modify the length of the field from CHAR 5 to CHAR 4. by using the following:
COL_NM:String[4] =Handle_null(string_trim(COL_NM),"xxxx")
But dont know how to convert a CHAR to SMALLINT type.
The Modify stage explained in the pdf is not easy to follow. Any help would be much appreciated.
Thanks in advance,
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

See if this post helps. Ray mentioned a few conversion functions in that post. You can take a look at that.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Code: Select all

new_columnName:int32 = int32_from_string (old_columnName)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

DSguru2B wrote:

Code: Select all

new_columnName:int32 = int32_from_string (old_columnName)
Thanks DSguru2B appreciate it:

However, when I use it in the modify stage, it gives the following error:
main_program: Error parsing modify adapter: Error in binding: Unknown conversion: int16_from_string
Expected destination field selector, got: ")"; input:
CD_COL_1:String[4] =Handle_null(string_trim(CD_COL_1),"xxxx")
;
CD_COL_2:String[2] =Handle_null(string_trim(CD_COL_2),"xx")
;
CD_COL_2:int16 = int16_from_string (CD_COL_3)
;
main_program: Creation of a step finished with status = FAILED.
Thanks in advance,
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

Same error when I use new_columnName:int32 = int32_from_string (old_columnName)
Thanks in advance,
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Code: Select all

new_columnName:int32 = lookup_int32_from_string (old_columnName)
It is there in the same post referred by DSGuru.

Sam
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Look into the Modify Stage pdf help. There is a chart of all the conversion functions. From the error message it seems that sucha function doesnt exist. Dont have access to DS right now. If its not there, then use the function us1aslam1us advised.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Multiple defintion of the same output column is not permitted. In particular the following pair of specifications is illegal.
DS_MJ wrote:CD_COL_2:String[2] =Handle_null(string_trim(CD_COL_2),"xx")
;
CD_COL_2:int16 = int16_from_string (CD_COL_3)
;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

i guess that is a typo DS_MJ.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The problem with the Modify stage is that typos matter!
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