I have some subroutines declared in my PL/1 program as below.
DCL RPFREAD ENTRY(*,*);
DCL RPFOPEN ENTRY(*);
DCL SGMGS EXTERNAL ENTRY(*,*);
Can any one explain the difference between Entry and External Entry
statements in PL/1?
Thanx
Sati
There is no difference. The EXTERNAL attribute is implied when
declaring an ENTRY constant. The flip-side is the VARIABLE
attribute which allows the declared name to be assigned, eg.
DECLARE E ENTRY VARIABLE;
DECLARE A ENTRY EXTERNAL;
DECLARE B ENTRY;
E = A;
CALL E;
E = B;
CALL E;
Tim.
I think you are right, but isn't VARIABLE a relatively
recent addition to PL/I? Without it, is it possible to
declare ENTRY variables at all? If so, are there almost
ambiguous cases?
-- glen
Back in the (F) days, internal entries were also supposed to be
declared, even though it was obviously redundant.
Also, there have always been such things as entry parameters.
Entry variables came in in 1970 as part of the Optimizer/Checker generation.
Somehow I thought they were earlier. Did they have Fortran 66 style
(through 95) ENTRY name as procedure argument, but that you could
only call and not assign? That wouldn't be ambiguous.
-- glen
The PROCEDURE statement defines an ENTRY constant, which is an entry point for
that procedure, for each name that appears in its label prefix.
The ENTRY statement defines an ENTRY constant, which is an entry point for the
innermost procedure in which it appears, for each name that appears in its
label prefix.
An external procedure is not contained in any other procedure of begin block
but may be within a package. An internal procedure is nested in one or more
containing procedure or begin blocks (at least one of which is necessarily a
procedure since BEGIN statements must occur within a procedure.).
The scope of all entry constants defined for a procedure is the block in which
the procedure is immediately contained if the procedure is internal; otherwise
an entry constant has external scope.
The ENTRY attribute may be used within a DECLARE statement to define an entry
variable within the block in which the declaration appears or to specify the
attributes of the parameter(s) and returned value (if any) of an external
entry constant invoked from within the block in which the declaration appears.
Yes.
It has always been possible to declare ENTRY,
and to use procedure names as arguments.
Now you're contradicting youself. A few hours ago,
you said that you thought that they were a recent addition.
> Did they have Fortran 66 style
> (through 95) ENTRY name as procedure argument, but that you could
> only call and not assign? That wouldn't be ambiguous.
Procedure (ENTRY) names have always been acceptable as arguments.
You are mostly correct. In the specific example, E is not required to
be EXTERNAL. In fact, most of the time I would expect E to be INTERNAL.
This does not exclude the E=B; assignment. And the eventual CALL E
[even though E is INTERNAL] would actually call B, the EXTERNAL ENTRY.
Maybe a bit confusing, but this is one of the distinctions between a
VARIABLE and a 'constant'.
--
Carl