The ENTRY attribute specifies that the name being declared is either an external entry constant, or an entry variable. It also describes the attributes of the parameters of the entry point.
If no parameter descriptor list is given, the default is for the argument attributes to match the parameter attributes. Thus, the parameter descriptor list must be supplied if argument attributes do not match the parameter attributes.
Each parameter descriptor corresponds to one parameter of the entry point invoked and, if given, specifies the attributes of that parameter.
The parameter descriptors must appear in the same order as the parameters they describe. If a descriptor is absent, the default is for the argument to match the parameter.
If a descriptor for a parameter is not required, the absence of the descriptor must be indicated by an asterisk. For example:
|
entry(character(10),*,*,fixed dec) |
Indicates four arguments. |
|
entry(*) |
Indicates one argument. |
|
entry( ) |
Specifies that the entry name must never have any arguments. |
|
entry |
Specifies that it can have any number of arguments. |
|
entry(float binary,*) |
Indicates two arguments. |
Defaults are not applied if an asterisk is specified. For example, in the following declaration defaults are applied only for the second parameter.
dcl X entry(* optional, aligned); /* defaults applied for 2nd parm */
Extents (lengths, sizes, and bounds) in parameter descriptors must be specified as constants or as asterisks. Controlled parameters must have asterisks.
RETURNS attribute implies the ENTRY attribute. For example:
| Example parameter descriptors | Declarations for example descriptors |
|---|---|
Test: procedure (A,B,C,D,E,F);
declare A fixed decimal (5),
B float binary (21),
C pointer,
1 D,
2 P,
2 Q,
3 R fixed decimal,
1 E,
2 X,
2 Y,
3 Z,
F(4) character (10);
end Test; |
declare Test entry
(decimal fixed (5),
binary float (21),
*,
1,
2,
2,
3 decimal fixed,
*,
(4) char(10)); |
In the previous example, the parameter C, and the structure parameter E do not have descriptors.