Home > Archive > Cobol > July 2006 > DISPLAY pointer
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Frank Swarbrick 2006-07-17, 6:55 pm |
| From ISO/IEC 1989:2002(E):
"14.8.10 DISPLAY statement
The DISPLAY statement causes data to be transferred to an appropriate
hardware device."
"14.8.10.2 Syntax rules
FORMAT 1
1) Identifier-1 shall not reference a data item of class object or class
pointer."
Adding some "sanity checking" to OpenCOBOL. It currently supports
DISPLAY of data items defined as USAGE POINTER. Why is this not
supported by the standard? Even little COBOL/VSE supports it (as an
extension), and I'm just wondering why its explicitly disallowed in the
standard. I suppose its because a pointer is a reference to something
rather than a something itself, but I just don't see that as being a
valid reason.
Frank Swarbrick
| |
| William M. Klein 2006-07-17, 6:55 pm |
| USAGE POINTER items are often (usually? almost always?) stored as an address.
HOWEVER, they are not required to be stored this way. Therefore, there is
nothing to say that "DISPLAYing" what is in a USAGE POINTER item makes any
sense. (In theory, it could be the name of the monk who has his finger
pointing to the correct place; not likely, but allowed by the Standard).
This is also why the Standard doesn't allow one to do "arithmetic" directly on a
USAGE pointer data item.
--
Bill Klein
wmklein <at> ix.netcom.com
"Frank Swarbrick" <infocat@earthlink.net> wrote in message
news:4LQug.728$bP5.698@newsread1.news.pas.earthlink.net...
> From ISO/IEC 1989:2002(E):
>
> "14.8.10 DISPLAY statement
>
> The DISPLAY statement causes data to be transferred to an appropriate hardware
> device."
>
> "14.8.10.2 Syntax rules
>
> FORMAT 1
>
> 1) Identifier-1 shall not reference a data item of class object or class
> pointer."
>
> Adding some "sanity checking" to OpenCOBOL. It currently supports DISPLAY of
> data items defined as USAGE POINTER. Why is this not supported by the
> standard? Even little COBOL/VSE supports it (as an extension), and I'm just
> wondering why its explicitly disallowed in the standard. I suppose its
> because a pointer is a reference to something rather than a something itself,
> but I just don't see that as being a valid reason.
>
> Frank Swarbrick
| |
| Frank Swarbrick 2006-07-17, 6:55 pm |
| William M. Klein wrote:
> USAGE POINTER items are often (usually? almost always?) stored as an address.
> HOWEVER, they are not required to be stored this way. Therefore, there is
> nothing to say that "DISPLAYing" what is in a USAGE POINTER item makes any
> sense. (In theory, it could be the name of the monk who has his finger
> pointing to the correct place; not likely, but allowed by the Standard).
Nonetheless, even if the pointer is the name of a monk who has his
finger pointing to the correct place, there would still be a unique monk
for each pointer, and therefore his name might be useful. :-)
> This is also why the Standard doesn't allow one to do "arithmetic"
> directly on a USAGE pointer data item.
What about SET FORMAT 9 (data-pointer-arithmatic)?
SET MY-ADDR UP BY 1
Frank
| |
| William M. Klein 2006-07-17, 9:55 pm |
| The whole point of the SET Up / Down by is to do the EQUIVALENT of arithmetic -
without actually doing it.
What you can't do is
Add +1 to Ptr-Item
P.S. I think that the restriction on DISPLAY goes back to 16-bit "DOS" (PC-type
DOS, not IBM pre-VSE DOS). Those addresses were pretty "odd" if you tried to do
a DISPLAY on them.
--
Bill Klein
wmklein <at> ix.netcom.com
"Frank Swarbrick" <infocat@earthlink.net> wrote in message
news:44BC297A.3020507@earthlink.net...
> William M. Klein wrote:
>
> Nonetheless, even if the pointer is the name of a monk who has his finger
> pointing to the correct place, there would still be a unique monk for each
> pointer, and therefore his name might be useful. :-)
>
>
> What about SET FORMAT 9 (data-pointer-arithmatic)?
> SET MY-ADDR UP BY 1
>
> Frank
| |
| Howard Brazee 2006-07-25, 6:55 pm |
| On Tue, 18 Jul 2006 03:34:18 GMT, "William M. Klein"
<wmklein@nospam.netcom.com> wrote:
>The whole point of the SET Up / Down by is to do the EQUIVALENT of arithmetic -
>without actually doing it.
I thought it was just the opposite: to do Arithmetic, but not using
the language we're used to.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
|
|
|
|
|