Invalid whole number when returning a string



IBM's Command List programming language & Restructured Extended Executor

Invalid whole number when returning a string

Postby deucalion0 » Thu Dec 18, 2014 5:41 pm

I wrote a subroutine in Rexx, the code works, it does what it is meant to, but at the end I get this message:

IRX0026I Error running R12, line 129: Invalid whole number

My code:


n="Paul"
n = mobile(n)
say n

mobile:                                               
   PARSE ARG name                                     
select                                                 
when name="Paul"THEN DO               
name="Paul Smith"   
END                                                   
when name=="Robert"THEN DO               
name="Robert Smith"   
end                                                   
otherwise nop
end         
             
RETURN name 
EXIT         


I worry when I get messages, I cannot have this Rexx fail on me. I spent a long time Googling this message but I did not get any clarification, any advice is much appreciated!

Thank you!
deucalion0
 
Posts: 55
Joined: Thu Jul 31, 2014 3:47 pm
Has thanked: 31 times
Been thanked: 0 time

Re: Invalid whole number when returning a string

 

Re: Invalid whole number when returning a string

Postby Pedro » Thu Dec 18, 2014 7:00 pm

Your program calls the MOBILE() function, which returns a full name, then returns to the caller. Then the main routine falls through to the MOBILE procedure.

I think you need to end the main routine with a RETURN or an EXIT before it falls through to the MOBILE procedure.
Pedro Vera

These users thanked the author Pedro for the post:
deucalion0 (Thu Dec 18, 2014 7:22 pm)
User avatar
Pedro
 
Posts: 571
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 40 times

Re: Invalid whole number when returning a string

Postby deucalion0 » Thu Dec 18, 2014 7:23 pm

What a silly mistake I made!

I had my exit in the wrong place! I forgot to move it before the subroutune, many thanks for point out what was staring me right in the face! :)

Cheers!!
deucalion0
 
Posts: 55
Joined: Thu Jul 31, 2014 3:47 pm
Has thanked: 31 times
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post