INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a Computer / IT professional? Join Tek-Tips now!
- 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.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Feedback
"...I have never been to any technical site that shows concern just to anybody with problems...I look forward to also share in the future..."
Geography
Where in the world do Tek-Tips members come from?
|
COBOL General discussion FAQ
|
Conditionals
|
Does order matter in conditional expressions?
Posted: 7 Mar 02
|
Yes, it can matter.
The COBOL standard specifies an order in which the terms of the conditional expression are evaluated. The standard specifies left-to-right evaluation, and further specifies that evaluation terminates as soon as the value of the conditional expression can be determined.
The practical use of this is a situation wherein if the first term is TRUE the evaluation of the second term might result in a runtime error:
PERFORM A-PARAGRAPH UNTIL A-SUBSCRIPT > SUBSCRIPT-LIMIT OR A-TABLE (A-SUBSCRIPT) = SPACES.
In this example, the COBOL standard requires that A-SUBSCRIPT > SUBSCRIPT-LIMIT, the leftmost boolean term, be evaluated first and, if true, terminate evaluation (because the entire expression will be TRUE) before testing A-TABLE (A-SUBSCRIPT), thereby avoiding a potential runtime problem (referring beyond the last item in a table). |
Back to COBOL General discussion FAQ Index
Back to COBOL General discussion Forum |
|
 |
|
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:
Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More...
Register now while it's still free!
Already a member? Close this window and log in.
Join Us Close