You never had to use old-fashioned Cobol, did you? The closest
thing to a function or procedure is 'perform', and there is no
parameter passing mechanism whatsoever.
That must be some *mighty* "old-fashioned" COBOL. I haven't been
able to track down the original CODASYL report, but one source
claimed that CALL ... USING was introduced "early in the development"
of COBOL, and another that COBOL has "always" had CALL ... USING.
Nested programs were only standardized in COBOL 85, but I'm not aware
of any COBOL version where you couldn't call other programs - they
just had to be in separate source files.
So you create some global
variables for the use of the performed paragraph, stuff values in
them, and use self discipline to not use them for other purposes.
That certainly was the dominant practice (though some people prefer
to use sections rather than paragraphs - a distinction of importance
only to COBOL programmers), and as far as I can tell still is. And
prior to the 2002 standard there was no standard way to have
recursive (including mutually recursive) calls, though many implemen-
tations supported them as an extension.
But you could also write your application as an initial program and
subprograms, in COBOL parlance, which would all run in the same "job"
or "process". This is still somewhat more limited than C; besides
the lack of recursion, there's no equivalent of "static" (all
program names are externally visible) and while some implementations
(and, I think, the X/Open standard, though not the ISO standard)
provided a way to pass a return code, a program call couldn't be used
in an expression, so there was no function-like behavior. (Now COBOL
has support for user-defined functions.)
Traditional BASIC had no way to pass parameters to subroutines, did
it? They had to be global-scope variables (because there wasn't any
other scope).
At any rate, though, I agree that in these languages common practice
was to use global-scope variables for passing parameters, because the
language either didn't provide a parameter-passing mechanism or made
it cumbersome.
--
Michael Wojcik (e-mail address removed)
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
-- David Bonde