Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Bad arithmetic conversion error while running

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
Author Message
vidyasaraswathi

Active User


Joined: 10 May 2005
Posts: 74

PostPosted: Fri Jun 03, 2005 6:01 pm    Post subject: Bad arithmetic conversion error while running
Reply with quote

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
View user's profile Send private message
References
PostPosted: Fri Jun 03, 2005 6:01 pm    Post subject: Re: Bad arithmetic conversion error while running Reply with quote

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3161
Location: Charlotte,NC USA

PostPosted: Fri Jun 03, 2005 8:33 pm    Post subject: Re: Bad arithmetic conversion error while running
Reply with quote

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
View user's profile Send private message
vidyasaraswathi

Active User


Joined: 10 May 2005
Posts: 74

PostPosted: Mon Jun 06, 2005 12:24 pm    Post subject: Re: Bad arithmetic conversion error while running
Reply with quote

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
View user's profile Send private message
phanirajasekhar

New User


Joined: 03 Jun 2005
Posts: 4
Location: Chennai

PostPosted: Mon Jun 06, 2005 1:56 pm    Post subject: Re: Bad arithmetic conversion error while running
Reply with quote

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
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 3161
Location: Charlotte,NC USA

PostPosted: Mon Jun 06, 2005 6:49 pm    Post subject: Re: Bad arithmetic conversion error while running
Reply with quote

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
View user's profile Send private message
MGIndaco

Moderator


Joined: 10 Mar 2005
Posts: 479
Location: Milan, Italy

PostPosted: Wed Jun 08, 2005 8:28 pm    Post subject:
Reply with quote

I'm in accord with Superk, this kind of error is ordinary...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1