Here's a snip of code that forces a user to enter a valid option and
avoids the problem of typing other than a simple numeric choice 1 to 5.

answer = ''

do until index('12345',answer) > 0                                

    say  'Do you want to do something?'   

    say 'Enter: 1=Yes 2=Yes_to_All 3=No 4=No_to_All 5=Abort'

    pull answer .                                                 

    End                                                        

reply = word('Yes Yes_to_All No No_to_All Abort',answer)               

say 'Reply is:' reply                                  

if answer = 1 then do


    say 'yes do it'

    end

 

etc.etc.

________________________________

From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED] On
Behalf Of Howard Rifkind
Sent: Monday, July 07, 2008 11:38 AM
To: [email protected]
Subject: Re: REXX coding question.

 

Thanks every one...yes the &'s have it.  That worked thanks again.

>>> "McKown, John" <[EMAIL PROTECTED]> 7/7/2008 12:31 PM >>>

Your logic is faulty. Suppose that  ANSWER is Y.

 

ANSWER /= 'Y' is false.

ANSWER /= 'YES' is true.

 

TRUE or FALSE is TRUE, so you execute the contents of the IF statement.
Perhaps you need an AND instead of OR?

 

Or am I the one confused?

 

--
John McKown
Senior Systems Programmer
HealthMarkets
Keeping the Promise of Affordable Coverage
Administrative Services Group
Information Technology

This message (including any attachments) contains confidential
information intended for a specific individual and purpose, and its
content is protected by law.  If you are not the intended recipient, you
should delete this message and are hereby notified that any disclosure,
copying, or distribution of this transmission, or taking any action
based on it, is strictly prohibited.
  

 

         

        
________________________________


        From: The IBM z/VM Operating System
[mailto:[EMAIL PROTECTED] On Behalf Of Howard Rifkind
        Sent: Monday, July 07, 2008 11:24 AM
        To: [email protected]
        Subject: REXX coding question.

        This is confusing me.

         

        The response to the variable 'answer' is a Y.

         

        Yet this portion of the code isn't working.  Shouldn't the logic
just fall thru because the response was a Y.

         

        IF SUBSTR(ANSWER,1,1) /= 'Y' | ANSWER /= 'YES' THEN   
           DO                                                 
             SAY ANSWER                                       
             SAY 'THE WRONG RESPONSE HAS BEEN ENTERED'        
             SAY                                              
             SAY 'PROCEDURE IS TERMINATING, PLEASE TRY AGAIN' 
             EXIT                                             
           END                                                

         

        Thanks

         


_____________
LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential
and may be privileged. It is intended for the addressee(s) only.
Access to this E-mail by anyone else is unauthorized.
If you are not an addressee, any disclosure or copying of the
contents of this E-mail or any action taken (or not taken) in
reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately, then delete this
message and empty from your trash.

 


_____________
LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential
and may be privileged. It is intended for the addressee(s) only.
Access to this E-mail by anyone else is unauthorized.
If you are not an addressee, any disclosure or copying of the
contents of this E-mail or any action taken (or not taken) in
reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately, then delete this
message and empty from your trash.

 

Reply via email to