MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error in a simple REXX exec !!!

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Thu Aug 07, 2003 2:33 am    Post subject: Error in a simple REXX exec !!! Reply with quote

Hi,

I am a beginner. This is simple program in REXX to add two numbers.

/* rexx ******************************/
say 'enter a no '
pull number1
say 'enter second no '
pull number2
sum = number1 + number2
say 'the sum is ' sum


Its giving error in statement sum = number1 + number2 .

Please suggest the reason.

Thanks in advance.


Last edited by Nancy on Thu Aug 07, 2003 4:11 am; edited 1 time in total
Back to top
View user's profile Send private message
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Thu Aug 07, 2003 2:40 am    Post subject: Reply with quote

Nancy,

Would you mind me asking, what error it gives you?
Back to top
View user's profile Send private message Send e-mail
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Thu Aug 07, 2003 2:43 am    Post subject: Reply with quote

Error is -->

Error running R0807A, line 6: Bad arithmetic conversion

Regards
Back to top
View user's profile Send private message
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Thu Aug 07, 2003 2:48 am    Post subject: Reply with quote

Probably you are not entering numbers when it asks you to 'enter a no ' and 'enter second no '. What are you typing?
Back to top
View user's profile Send private message Send e-mail
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Thu Aug 07, 2003 2:50 am    Post subject: Reply with quote

I am simply entering the numbers only. U can also try it on your machine. It wont take more than 5 minutes.
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Thu Aug 07, 2003 3:02 am    Post subject: Reply with quote

Try "say number1 number2' before sum to see if it is coming properly?
Back to top
View user's profile Send private message Send e-mail
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Thu Aug 07, 2003 3:38 am    Post subject: Reply with quote

Nancy,

Yes. What I did before my first post is to try in our machine. It is working fine for me.
Back to top
View user's profile Send private message Send e-mail
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Thu Aug 07, 2003 3:51 am    Post subject: Reply with quote

yes. The error is because of spaces only. i am now trying to use PARSE but the same error is coming in that also.
My code is looking like -

/* rexx ******************************/
say 'enter a no '
pull number1
PARSE VAR NUMBER1 VALUE1 SPACE1
say 'enter second no '
pull number2
PARSE VAR NUMBER2 VALUE2 SPACE2
say number1 number2
sum = value1 + value2
say 'the sum is ' sum

Regards
Back to top
View user's profile Send private message
Nancy
Beginner


Joined: 23 May 2003
Posts: 77
Topics: 26

PostPosted: Thu Aug 07, 2003 4:24 am    Post subject: Reply with quote

Working fine now. Actually the problem was with the way of execution. After entering the first number, when it asks for the second number, I was giving second no in that line only. hence it was taking the spaces. While it should be entered after hitting one ENTER again.

This can also be done by writing CLEAR in the second line of the program.

Thanks to all.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group