MichaelHuber
Programmer
Can anyone explain these results?
When I pass a short string to a function expecting a long string, then try ATODBL on the string, it returns 0!
Here's some sample code:
DEFINE FUNCTION FN1(MYINPUT/A3)
MYLEN/I3 = ARGLEN(3, MYINPUT, 'I3');
MYVAL/D3 = ATODBL(MYINPUT, '03', 'D3');
FN1/A40 = 'MYINPUT:{' | MYINPUT | '} MYLEN:' | EDIT(MYLEN) | ' MYVAL:' | EDIT(MYVAL);
END
-RUN
-SET &INVAL1 = '1 ';
-SET &OUTVAL1 = FN1(&INVAL1);
-TYPE &OUTVAL1
-SET &INVAL2 = '12 ';
-SET &OUTVAL2 = FN1(&INVAL2);
-TYPE &OUTVAL2
-SET &INVAL3 = '123';
-SET &OUTVAL3 = FN1(&INVAL3);
-TYPE &OUTVAL3
-SET &INVAL4 = '1234';
-SET &OUTVAL4 = FN1(&INVAL4);
-TYPE &OUTVAL4
-TYPE Above results are expected.
-TYPE Below results are FUBAR.
-SET &INVAL5 = '1';
-SET &OUTVAL5 = FN1(&INVAL5);
-TYPE &OUTVAL5
-SET &INVAL6 = '12';
-SET &OUTVAL6 = FN1(&INVAL6);
-TYPE &OUTVAL6
Thanks for any ideas you might have!
By the way, I'm using WebFOCUS 5.2
Regards,
Michael
When I pass a short string to a function expecting a long string, then try ATODBL on the string, it returns 0!
Here's some sample code:
DEFINE FUNCTION FN1(MYINPUT/A3)
MYLEN/I3 = ARGLEN(3, MYINPUT, 'I3');
MYVAL/D3 = ATODBL(MYINPUT, '03', 'D3');
FN1/A40 = 'MYINPUT:{' | MYINPUT | '} MYLEN:' | EDIT(MYLEN) | ' MYVAL:' | EDIT(MYVAL);
END
-RUN
-SET &INVAL1 = '1 ';
-SET &OUTVAL1 = FN1(&INVAL1);
-TYPE &OUTVAL1
-SET &INVAL2 = '12 ';
-SET &OUTVAL2 = FN1(&INVAL2);
-TYPE &OUTVAL2
-SET &INVAL3 = '123';
-SET &OUTVAL3 = FN1(&INVAL3);
-TYPE &OUTVAL3
-SET &INVAL4 = '1234';
-SET &OUTVAL4 = FN1(&INVAL4);
-TYPE &OUTVAL4
-TYPE Above results are expected.
-TYPE Below results are FUBAR.
-SET &INVAL5 = '1';
-SET &OUTVAL5 = FN1(&INVAL5);
-TYPE &OUTVAL5
-SET &INVAL6 = '12';
-SET &OUTVAL6 = FN1(&INVAL6);
-TYPE &OUTVAL6
Thanks for any ideas you might have!
By the way, I'm using WebFOCUS 5.2
Regards,
Michael