Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

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

"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."



Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
08-29-07 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:22 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.