From jkr@jkr.cc.rl.ac.uk  Wed Feb 21 12:32:06 2001
Received: from nameserv.rl.ac.uk (nameserv.rl.ac.uk [130.246.135.129])
	by dkuug.dk (8.9.2/8.9.2) with ESMTP id MAA77076
	for <SC22WG5@dkuug.dk>; Wed, 21 Feb 2001 12:32:06 +0100 (CET)
	(envelope-from jkr@jkr.cc.rl.ac.uk)
Received: from jkr.cc.rl.ac.uk (jkr.cc.rl.ac.uk [130.246.8.20])
	by nameserv.rl.ac.uk (8.8.8/8.8.8) with ESMTP id LAA15332
	for <SC22WG5@dkuug.dk>; Wed, 21 Feb 2001 11:32:01 GMT
Received: (from jkr@localhost)
	by jkr.cc.rl.ac.uk (8.8.8+Sun/8.8.8) id LAA21717
	for SC22WG5@dkuug.dk; Wed, 21 Feb 2001 11:33:51 GMT
Date: Wed, 21 Feb 2001 11:33:51 GMT
From: John Reid <jkr@rl.ac.uk>
Message-Id: <200102211133.LAA21717@jkr.cc.rl.ac.uk>
To: SC22WG5@dkuug.dk
Subject: Iterpretation 20 (WHERE): Draft response
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"

Dear WG5,
         Here is my next draft interpretation response. As far as
I know, this is the first attempt at a response to this one. I would
appreciate comments before I send it to J3, preferably to me in
private.

Cheers,

John. 


NUMBER: 000020
TITLE: Execution of a WHERE statement within a WHERE construct
KEYWORDS: WHERE statement, WHERE construct
DEFECT TYPE:
STATUS: J3 consideration in progress

QUESTION:  7.5.3.2 [113:17-19] indicates that:

   Upon execution of a WHERE statement or a WHERE construct statement that
   is part of a <where-body-construct>, the pending control mask is
   established to have the value m .AND.(.NOT. mask-expr).
                                  c

[112:41-45] indicates that:

   Upon execution of an ENDWHERE statement, the control mask and pending
   control mask are established to have the values they had prior to the
   execution of the corresponding WHERE construct statement.  Following the
   execution of a WHERE statement that appears as a <where-body-construct>, the
   control mask is established to have the value it had prior to the execution
   of the WHERE statement.

Notice that after execution of an ENDWHERE statement, the pending control mask
is established to have the value it had prior to the execution of the
corresponding WHERE construct statement, but the same is not the case for the
pending control mask established by the execution of a WHERE statement that
appears as a <where-body-construct>.

According to this, the output of the following program

      PROGRAM P
        INTEGER :: A(2) = 0, B(2) = 0

        WHERE((/.TRUE.,.TRUE./))
          WHERE((/.TRUE.,.FALSE./)) A = 1
        ELSEWHERE
          A = 2
        END WHERE
        PRINT *, A

        WHERE((/.TRUE.,.TRUE./))
          WHERE((/.TRUE.,.FALSE./))
            B = 1
          END WHERE
        ELSEWHERE
          B = 2
        END WHERE
        PRINT *, B
      END PROGRAM P

will be

 1 2
 1 0

Was this difference in behaviour intended by the committee?

ANSWER:

No. It was intended that
     WHERE(<mask-expr>) <where-assignment-stmt>
should have the same interpretation as 
     WHERE(<mask-expr>) 
         <where-assignment-stmt>
     END WHERE
The output from the above program should be
 1 0
 1 0

An edit is supplied to correct the text.
 
EDIT:

Page 113, subclause 7.5.3.2. In the first line of the paragraph
following NOTE 7.48 [113:17] delete 'a WHERE statement or'; add to the
end of the paragraph [113:20] 'Upon execution of a WHERE statement
that is part of a where-body-construct, the control mask is established
to have the value <m_c>.AND.<mask-expr>.'

SUBMITTED BY: Henry Zongaro
HISTORY: 98-149   m145 Submitted
