In UV BASIC the case syntax is:
BEGIN CASE
CASE expression
statements
[CASE expression
statements
.
.
.
]
END CASE
In a psuedocode sense I want to have an ELSE after my CASE's and before the END CASE.
What is the best way to approach this. At the moment I'm working on a routine and want to pass an error message to Ans I fail to get a match on my case comparisons. I thought maybe I could set Ans to my error message before my CASE, but there are other places afterwards I want to have error handling, so I'd still need a way to know I didn't have a case match and to exit the routine there with my error message.
Probably easy, but it's been a long day.
Thanks,
Doing an ELSE CASE within a CASE
Moderators: chulett, rschirm, roy
Doing an ELSE CASE within a CASE
Byron Paul
WARNING: DO NOT OPERATE DATASTAGE WITHOUT ADULT SUPERVISION.
"Strange things are afoot in the reject links" - from Bill & Ted's DataStage Adventure
WARNING: DO NOT OPERATE DATASTAGE WITHOUT ADULT SUPERVISION.
"Strange things are afoot in the reject links" - from Bill & Ted's DataStage Adventure
Craig is correct.
Code: Select all
begin case
case x=1
stmt1
case y=1
more stmt
case @true
stmt3
end case
Mamu Kim
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I once knew a programmer who did this.
Unfortunately the formatter doesn't know about it, so formats the OTHERWISE line incorrectly, which was subsequently adjusted manually.
Code: Select all
Equate OTHERWISE Lit "CASE 1"
BEGIN CASE
CASE expr1
statements
CASE expr2
statements
:
OTHERWISE
statements
END CASE
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Ray
I used to do this:
Reads nice.
I used to do this:
Code: Select all
Otherwise = @true
Begin case
case x=1
case x=2
case Otherwise
end case
Mamu Kim