Re: COBOL's Influence on C
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Wed, 14 Nov 2007 22:35:51 GMT
Robert's reply seems to "assume" an IBM mainframe environment. Most of what he
says MAY be available in other environments, but may not be universally
"relevant".
--
Bill Klein
wmklein <at> ix.netcom.com
"Robert Jones" <rjones0@xxxxxxxxxxx> wrote in message
news:1195079026.976230.183910@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Nov 14, 7:54 pm, "Frank Swarbrick" <Frank.Swarbr...@xxxxxxxxxxxxxx>
wrote:
<snckj3564s4rjul5ctvffht6imaih84...@xxxxxxx>, Robert<n...@xxxxxx> wrote:On 11/13/2007 at 5:18 PM, in message
On Tue, 13 Nov 2007 12:47:57 -0600, "tlmfru" <la...@xxxxxxx> wrote:
Robert <n...@xxxxxx> wrote in message
news:dsmhj317b7236kep9l7j2i53jp39dcvlo6@xxxxxxxxxx
On Mon, 12 Nov 2007 10:19:38 -0500, "Rick Smith" <ricksm...@xxxxxxx>wrote:
Modern BASICs also use conditions in the SELECT CASE
statement and may have been influenced by COBOL. <g>
Speaking of modern BASICs ...
GOSUB, which is the same as Cobol's out of line PERFORM, has beendepreciated by many/most
compilers and dropped from VB.NET. It was replaced by SUB, which is alocal function
call. In my opinion, Cobol should have done the same.
In my opinion and usage, the word SUB, short for SUBroutine, refers to ausually
stand-alone piece of code not included with the source program under
consideration. (It can certainly be in the same compilation unit, of
course). A function in this context is some common routine which isn't
compiled (I say this to keep OO vocabulary out of the discussion),
supplied by the compiler writers: e.g., calls on the OS. There should bea
completely different verb to execute sections of code within the sourcecan
program as opposed to that used to execute wholly external sections.
COBOL's PERFORM does the first perfectly well - unambiguous,
understandable - and CALL (or INVOKE, etc.) does the second: and neither
be mistaken for the other. Why change?
The target of a Cobol CALL can be in the same source or it can be
external.
butIn PROGRESS, a language I have little love for but have had to use quitea
bit, the in-line perform is WHILE, and the out-of-line perform is RUN:
RUN is also used as the CALL. If the label isn't defined within thecurrent
source, it's assumed to be an external routine: no precautionarydiagnostic.
So it's very common to have a clean compile which then blows up withas
unresolved linkages when attempting to execute. Not the same situation
what Robert's suggesting but a cautionary tale.
Cobol, along with most compiled languages, is the same. Depending on
linker options, you
learn of missing external names either at link or execution time.
Unlike most compiled languages, Cobol lets you CALL a name stored in a
variable. That kind
can only be bound at execution time. The calling program can handle
missing names with an
ON condition, but it's usually too late to do anything but abort. I've
never really needed
that feature. It is a bad idea for two reasons. First, it usually slows
every call, not
just the first. Second, the linker/loader nor tools like ldd cannot
check those references
because they don't know what value will be in the variable at execution
time. It's usually
a constant, but there's no way to declare that.
On Unix, you can check for missing externals by running "ldd -r
(program)', both after
compilation and before execution. Do z/OS or CA-7 have that ability?
I don't have much Cobol experience on the PC (or Unix et al), but on the
mainframe we use dynamic calls (CALL data-name) almost exclusively. While
I'm sure a static call is faster, we've never had a performance issue. It's
very nice to be able to change a subroutine and not have to do a static
relink of all calling programs.
Frank
The term dynamic can get very confusing at times. If you use CALL
data-name the call is always dynamic, while if you use CALL literal,
it may or may not be, depending upon your compiler and consequent
linkage editor or binder options. It has been possible to do dynamic
calls with both CALL literal and CALL data-name from the late 1970s.
The difference in performance between dynamic and static linkage is
insignificant, unless one is also repetitively cancelling dynamically
called program. One would expect an overall performance improvement
in a multitasking environmnet due to the lack of need for multiple
copies of all the COBOL language subroutines in memory, which should
reduce the amount of paging required. However, if one wants to run
multiple instances of the same COBOl program at once, then the user
written subroutines can't be in the link pack area (I have a feeling
that is called the RRR (I don't know what it stands for, perhaps
resident routines region?)in DOS/VSE), but they can still be invoked
from the JOBLIB and STEPLIB library specs.
Anyone care to elaborate?
.
- References:
- COBOL's Influence on C
- From: Rick Smith
- Re: COBOL's Influence on C
- From: Robert Jones
- Re: COBOL's Influence on C
- From: Rick Smith
- Re: COBOL's Influence on C
- From: Charles Hottel
- Re: COBOL's Influence on C
- From: Judson McClendon
- Re: COBOL's Influence on C
- From: Rick Smith
- Re: COBOL's Influence on C
- From: Robert
- Re: COBOL's Influence on C
- From: tlmfru
- Re: COBOL's Influence on C
- From: Robert
- Re: COBOL's Influence on C
- From: Frank Swarbrick
- Re: COBOL's Influence on C
- From: Robert Jones
- COBOL's Influence on C
- Prev by Date: Re: COBOL's Influence on C
- Next by Date: Re: occurs
- Previous by thread: Re: COBOL's Influence on C
- Next by thread: Re: COBOL's Influence on C
- Index(es):
Relevant Pages
|
Loading