Re: CONSTANT ENTRY (was "forward" references (was: COBOL subscript range checking))





"William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx> wrote in message
news:ON4Bi.258300$rk4.112517@xxxxxxxxxxxxxxxxxxxxxxxxx
Pete,
For example,

The '02 Standard allows for
COPY "literal-name". *> previously this was an extension

Suppose you had

Copy XYZ.

And within a member LMN, you had
01 XYZ Constant Value "LMN".

but you didn't have any copy member XYZ.

As the '02 Standard currently stands (and *if* you allow constants to be
used in the text manipulation stage), then it APPEARS that the Standard
would require an implement to copy in the member "LMN" *before* it could
know that "XYZ" was actually a constant name with the value "LMN".

Does this help you understand what this problem is?

Yes, I think so, but I can't believe this is problematic. The old circular
reference trick... Surely the Standard doesn't allow that?

The fact that LMN contains a constant called XYZ has no bearing whatsoever
on the statement to COPY XYZ. (Which occurs in source ABC, say...) Why would
it?

That is simply an illegal (circular) indirect reference. How can a source
possibly know what is in all other sources that might be copied? It can't,
and neither does it need to. If the action you actually want is to "COPY
LMN", then XYZ would need to be defined as a constant with a value of "LMN"
in the program where the COPY statement is made (ABC in my example), not in
some other book that MIGHT be COPYed, or even in one that IS COPYed.

No one could reasonably expect such a circular reference to work, and if the
standard allows it then that is probably an oversight. Seems to me that all
that is required is for the Standard to state explicitly that circular
references caused by using constants, or from any other cause, are coded at
the programmer's own risk, and results are implementor defined. (Caveat
emptor...)

In the example you're citing, the source can never be COPYed because there
is no XYZ, and it can't just KNOW that LMN was the intended COPYbook.

I would expect, and I think most people would agree, that it will throw a
compiler error of "COPYbook not found."
(I'd be perfectly happy with that; it would draw my attention to the
problem...)

If your argument is that COPY using the constant might occur in source
before the constant has been defined, thus requiring a forward reference,
yes, I agree, it needs a forward reference. But that isn't the end of the
world. Forward references can be dealt with easily by established techniques
in a multipass compiler.

Now, how many angels CAN stand on a pinhead...? :-)

Pete.
--
"I used to write COBOL...now I can do anything."


.



Relevant Pages

  • Re: Need another If/then code
    ... The ME is a reference to the form. ... I created the table, added the following code you suggested to the necessary field, and I got an error that says "Can't find macro 'Me' ". ... MS Access MVP ... WHERE XYZ>=MinNum and XYZ<MaxNum ...
    (microsoft.public.access.modulesdaovba)
  • Re: Newbie with Vector Problem
    ... > I have a linked list, in each element there is XYZ float values ... BUT I can fill the XYZ ... However you are mixing standard C++ with non-standard MFC stuff ... This group is for standard C++ only. ...
    (comp.lang.cpp)
  • Re: COUNTIF a value within a range equals any value in an array/li
    ... XYZ Yes ... LMN Yes ... "Roger Govier" wrote: ... The next column over is a number (elapsed time). ...
    (microsoft.public.excel.worksheet.functions)
  • Two domains
    ... I run SBS 2000/exchange 2000 with two registered ... MX of xyz is pointed to the ... Management doesnt want to have this reference. ...
    (microsoft.public.backoffice.smallbiz2000)
  • Exchange EMAILS TWO DOMAINS
    ... I run exchange 2000 with two registered ... MX of xyz is pointed to the ... Management doesnt want to have this reference. ... How can I avoid this. ...
    (microsoft.public.exchange2000.admin)