Re: Is it possible to use the value of the PROGRAM ID within the source code?
From: Robert Wagner (robert.deletethis_at_wagner.net)
Date: 06/12/04
- Previous message: Richard: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- In reply to: Chuck Stevens: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Next in thread: Richard: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Reply: Richard: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Reply: Chuck Stevens: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 12 Jun 2004 00:14:13 GMT
"Chuck Stevens" <charles.stevens@unisys.com> wrote:
>"Robert Wagner" <robert.deletethis@wagner.net> wrote in message
>news:40c9685a.589226654@news.optonline.net...
>
>> A general-purpose solution would be to walk back the call stack returning
>the
>> names of all programs from the program of interest back to Main.
>
>That is presuming that the implementation has an accessible structure such
>as a "call stack".
Every called program has a way of returning to its caller.
>> Generally, you can't pass strings on the stack. You can only pass words,
>such as
>> a pointer to the string. Make that 'CALL a-program USING (default BY
>REFERENCE)
>> a-program'.
>
>Last sentence first: "CALL a-program USING BY CONTENT a-program" would I
>think be preferable. The objective here is to ensure that a-program cannot
>step on this particular parameter.
But it can. It just cannot modify it back in the caller's memory.
I don't think this is a realistic concern. Programs generally don't recklessly
modify parameters.
>In our implementation, there is no pre-execution-time linking phase; the
>determination as to whether the target procedure is nested or
>separately-compiled has to be made at execution time and is a rather
>expensive process. Thus, while "CALL <dataname>" works it is almost
>invariably much more costly than "CALL <literal>".
It is in nearly all environments. It need not be. Sure, dataname can change, but
99.99 percent of the time it doesn't. INLINE code could (should) check that it's
the same and then call directly, with little more overhead than a static link. I
used to write enhancers that reached back and modified generated code to do
exactly that.
> where does the standard require that the implementor keep track of
>information about calling history in some sort of hardware stack? Where
>does the standard prohibit putting strings (do you mean strictly
>"alphanumeric literals" or do you include "alphanumeric data items"?) on
>that stack?
>
>BY CONTENT non-numeric parameters of arbitrary length are allowed.
>
>How the implementation *accomplishes* passing, say, a 30,000-byte record as
>a parameter BY CONTENT is none of the end user's business; the only concern
>is how the caller sees it if the called program happens to step on its
>contents (and the correct expectation is that it be unchanged).
True but discordant with the culture of operating systems and other languages.
Micro Focus says:
"If the program being called is not COBOL, the size of the additional data item
should not exceed the maximum size of the system area (typically the size of a
POINTER on the system); otherwise the system might become catastrophically
corrupt."
You wouldn't want to be the one found to have "catastrophically corrupted" the
system. I know .. FUD.
>What's this about words? It may be *common* to use some sort of fixed
>structure to describe a parameter passed by content -- but there is
>absolutely no requirement that that structure be inherently different from
>the structure that would be used for parameters passed by reference, or that
>the structure be related in any way to any other structure that might be
>used in the operating environment.
The idea of BY CONTENT and BY VALUE is based on paranoia and disrespect. Its
premise is that called programs may irrationally corrupt parameter values. In
the real world, that's not a realistic concern.
>Moreover, there is nothing except resources and incentive preventing an
>obsolete-computer buff from implementing a fully-2002-compliant COBOL
>implementation on a Burroughs B3500, or even an IBM 1401, for which
>architectures the concept of "fixed-length words" as I understand the
>concept does not exist.
On the 1401 I wrote a rudimentary operating system because the machine didn't
come with one. On the B3500/4700 I completely rewrite the communications
software and print spooler in Cobol and contributed to the design of MCPV.
You're correct: they didn't have words nor stacks, but they did have a pointer
back to the caller.
- Previous message: Richard: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- In reply to: Chuck Stevens: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Next in thread: Richard: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Reply: Richard: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Reply: Chuck Stevens: "Re: Is it possible to use the value of the PROGRAM ID within the source code?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|