Subject: | |
From: | |
Reply To: | |
Date: | Wed, 5 May 2004 21:20:51 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
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 *
|
|
|