Code Comments
Programming Forum and web based access to our favorite programming groups."William M. Klein" <wmklein@nospam.netcom.com> wrote in message news:ON4Bi.258300$rk4.112517@fe09.news.easynews.com... > 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."
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.