Simple conversion (char to int) and calculation

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_search2008
Participant
Posts: 75
Joined: Thu Nov 27, 2008 10:12 am

Simple conversion (char to int) and calculation

Post by ds_search2008 »

The input column is defined as INP_Col, char(30). The output column which is mapped to INP_COL column is also defined as char(30). I am confident that both input and output columns would contain only numeric value. I need to subtract an integer value from the input column (INP_Col,char data type) and store the result in the output. I am unable to get the desired output.

for example if the transformer derivation is

DSLink1.INP_Col - 5

The output is -5.

I thought DS would perform implicit conversion from char to int, subtract and give me the correct output. However, I don't think this is happening in this case. I used modify stage with

specification : CN1:int16 = lookup_int16_from_string (INP_Col) to convert this to integer and tried the calculation. Also tried other type conversion from Modify stage conversion table. But nothings works for this simple scenario. Can anybody please help me to fix this...
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Try this.

Code: Select all

CN1:int16=INP_Col
ds_search2008
Participant
Posts: 75
Joined: Thu Nov 27, 2008 10:12 am

Post by ds_search2008 »

Great!! Working fine. Thanks a lot...... :)
Post Reply