2
votes

I have migrated a Powerbuilder 9 application to PowerBuilder 12.5. After the migration, some functions are not working.

Following code is from a function which has blob argument blobi.

long ll_position, ll_start, ll_end

ll_position=Pos(String(blobi),'~f@1~r~n',1) //does not work.

The above line won't work in new version. I tried to check what value i get from ll_position:

messagebox("ll_position: ", ll_position)

In PB 9, it returns 1
In PB 12.5 it returns 0

Next step:

ll_start=ll_position+5 

ll_end=Pos(String(blobi),Char(126),ll_start)  //does not work.

I get following return values:

messagebox("ll_end: ", ll_end)

In PB 9, it returns 10
In PB 12.5 it returns 0

Next step:

dw_test.Object.numb[1]=Long(Mid(String(blobi),ll_start,ll_end -ll_start)) //does not work.

I get following return values:

long abc 
abc = dw_test.Object.numb[1]

messagebox("dw value is: ", abc)

in PB 9 it returns an integer like 1234
in PB 12.5 it returns 0

Please help me regarding what is problem with the above functions and how can I change them to work with PowerBuilder 12.5. Thanks.

1

1 Answers

4
votes

PowerBuilder 12.5 uses Unicode strings by default, so your String() function is taking two bytes to create one character. To maintain your existing functionality, use

String (blobi, EncodingANSI!)

Good luck,

Terry