×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

REXX Loop conditional statement not working

REXX Loop conditional statement not working

REXX Loop conditional statement not working

(OP)
Hi am neophyte here, can you check the script below on how to declare loops in the conditional statement which start from the highlighted below.

CODE --> REXX

Call ZocCls
  login = ZocAsk(" What is your name:? ")
   
  IF login = "##CANCEL##" THEN DO

   answer = ZocRequest(" Command Cancelled , Retry?", "Yes", "No")

    DO UNTIL answer = "No" 
END
SAY

 CALL ZocMsgBox "Good Bye, Have a Nice Day!"

SIGNAL endit
 END

 IF login = " " THEN DO
 
    ZocMsgBox(" Null Input, Please Try Again ")
 
  END
 
 ELSE DO
    /* Request to Proceed */

    ZocMsgBox(" Your Request will execute now ")

CALL ZocDelay 1

   ZocSend "Welcome back Mr/Ms '"||login||"' Have a great Day!^M"
END
endit:  /* target for the SIGNAL command above */

EXIT 

RE: REXX Loop conditional statement not working

please post your code formatted between the marks:
[code] 
... 
[/code] 

There is no error in your code, it works, the question is if it works as you expected.

RE: REXX Loop conditional statement not working

(OP)
Hi mikrom,

Yes the code is working so far, but the requirements doesn't met.

Scenario:
From the ZocRequest(Highlighted in Red) once the user pressed "Yes", the code exited instead it will loop again to

login = ZocAsk("What is your name:?"),

kindly add what am I missing. Thanks.

RE: REXX Loop conditional statement not working

Hi Jongskie,

You didn't quite succeed in formatting the code, it looks a bit messy.
The DO UNTIL loop looks different too as you posted before, now when the answer is not "No", it seems to run forever.

If you want on the answer = "Yes" to return again to login, then create a label on the place where you read login name. Then when the answer = "Yes" jump to the label, when the answer = "No" jump to the end of the program as you done before.

RE: REXX Loop conditional statement not working

I don't have the ZOC software, so this is what you can try in classical PC REXX (ooRexx, Regina):

CODE

logon:
CALL CHAROUT , "What is your name: "
PARSE UPPER PULL login

IF LOGIN = "##CANCEL##" THEN DO
  DO UNTIL answer = "YES" | answer = "NO"
    CALL CHAROUT , '"Command Cancelled, Retry? "Yes", "No": '
    PARSE UPPER PULL answer
  END
  IF answer = "YES" THEN DO
    SAY "Please Log On Again"
    SIGNAL logon
  END
  ELSE DO
    SAY "Good Bye, Have a Nice Day!"             
    SIGNAL endit
  END
END

IF LOGIN = " " THEN DO
  SAY "Null Input, Please Try Again"
END 
ELSE DO
  /* Request to Proceed */
  SAY "Your Request will execute now"
  CALL SYSSLEEP 1
  SAY "Welcome back Mr/Ms '"||login||"' Have a great Day!"
END

endit: /* target for the SIGNAL command above */
EXIT 

RE: REXX Loop conditional statement not working

(OP)
Hi mikrom,

Indeed, its ok now.

Thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close