HP3000-L Archives

May 2004, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Roy Brown <[log in to unmask]>
Reply To:
Roy Brown <[log in to unmask]>
Date:
Wed, 5 May 2004 21:20:51 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (52 lines)
In message
<[log in to unmask]>,
"Shahan, Ray" <[log in to unmask]> writes
>Hi all,
>
>Given the following WS:
>
>
>01  TEST-RANGE-SW                       PIC X(1).
>      88  TEST-RANGE                             VALUE "B" THRU "Y".
>
>
>
>Does the compiler generate code that determines (binary search, etc.)
>that a variable (or constant) is out of the acceptable range, or does
>the compiler actually generate code that would result in an evaluation
>of each condition one at a time?
>
>For example, I could create the self explanatory manual code:
>        IF "A" < "B"
>          PERFORM FOUND-IT.
>
>Or I could do this, but would the code have to check for every value of
>"B" through "Y" to determine that "A" was not in TEST-RANGE?
>        MOVE "A" TO TEST-RANGE-SW
>        IF NOT TEST-RANGE
>          PERFORM FOUND-IT.
>

>TIA for your time,
>
>
>Ray Shahan

At a guess:

'IF TEST-RANGE' is equivalent to:

IF  ( TEST-RANGE-SW >= "B"
AND   TEST-RANGE-SW <= "Y" )

and the compiler will have checked for VALUE "Y" THRU "B",
and other such oddities, and either thrown a compile error, or subtly
rearranged the THRU or the range test, so that the above works...

--
Roy Brown        'Have nothing in your houses that you do not know to be
Kelmscott Ltd     useful, or believe to be beautiful'  William Morris

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2