|
|
| Author |
Message |
vidyasaraswathi
Active User
Joined: 10 May 2005 Posts: 74
|
|
|
|
Hi,
I executed the following code in TSO 3.4 :
/***REXX*****************************/
SAY 'PLS ENTER A NUMBER'
PULL NUM1
SAY 'NOW ENTER A NUMBER TO ADD TO THE FIRST NUMBER.'
PULL NUM2
SUM = NUM1 + NUM2
SAY 'THE SUM OF THE TWO NUMBERS IS' SUM'.'
I got the following error message:
6 +++ SUM = NUM1 + NUM2
Error running ADD2NUM, line 6: Bad arithmetic conversion
***
Please anyone help me out? What is wrong with this??
Thanks and Regards,
Vidya Bhat |
|
| Back to top |
|
 |
References
|
Posted: Fri Jun 03, 2005 6:01 pm Post subject: Re: Bad arithmetic conversion error while running |
 |
|
|
 |
superk
Moderator Team Head
Joined: 26 Apr 2004 Posts: 3001 Location: Charlotte,NC USA
|
|
|
|
| The code works just fine. What did enabling the TRACE option show? I suspect that somehow one of your input values is non-numeric. |
|
| Back to top |
|
 |
vidyasaraswathi
Active User
Joined: 10 May 2005 Posts: 74
|
|
|
|
Hi superk,
I enabled the trace option and executed this. As you suspected, first number I entered was getting space.
Because, when the message 'PLS ENTER A NUMBER' comes I have to press ENTER key first and then have to enter the number.
Now it worked fine.
Thank you very much.
Vidya bhat |
|
| Back to top |
|
 |
phanirajasekhar
New User
Joined: 03 Jun 2005 Posts: 4 Location: Chennai
|
|
|
|
hi
i got that nothing wrong in the code
while entering the second number enter the number in the continuation screen
i.e, after getting the message enter number two press ctrl and then enter the second number
ENTER FIRST NUMBER
3
ENTER NUMBER TWO
***(next screen enter the other num)
5
sum 8
hope you got that |
|
| Back to top |
|
 |
superk
Moderator Team Head
Joined: 26 Apr 2004 Posts: 3001 Location: Charlotte,NC USA
|
|
|
|
| This is a good example of why you should validate that the input variables are numeric before using them in a computation. |
|
| Back to top |
|
 |
MGIndaco
Moderator
Joined: 10 Mar 2005 Posts: 479 Location: Milan, Italy
|
|
|
|
| I'm in accord with Superk, this kind of error is ordinary... |
|
| Back to top |
|
 |
|
|