Page 1 of 1

Modify Stage

Posted: Thu Dec 28, 2006 1:34 pm
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.

Posted: Thu Dec 28, 2006 1:45 pm
by DSguru2B
See if this post helps. Ray mentioned a few conversion functions in that post. You can take a look at that.

Posted: Thu Dec 28, 2006 2:07 pm
by DSguru2B

Code: Select all

new_columnName:int32 = int32_from_string (old_columnName)

Posted: Thu Dec 28, 2006 2:45 pm
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.

Posted: Thu Dec 28, 2006 2:47 pm
by DS_MJ
Same error when I use new_columnName:int32 = int32_from_string (old_columnName)

Posted: Thu Dec 28, 2006 2:49 pm
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

Posted: Thu Dec 28, 2006 3:44 pm
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.

Posted: Thu Dec 28, 2006 4:47 pm
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)
;

Posted: Thu Dec 28, 2006 4:53 pm
by us1aslam1us
i guess that is a typo DS_MJ.

Posted: Thu Dec 28, 2006 4:58 pm
by ray.wurlod
The problem with the Modify stage is that typos matter!