Document Number:     J4/02-0116
2002-05-17
D-1.1           Page    1  of   3

Subject:
Author:

Restricted program pointer with AS phrase on CALL stmt
Artur Reimann, Thane Hubbell

Previous Version:
References:

02-0095
 http://www.cobolstandard.info/j4020095.htm
1.

ISO/IEC FDIS 1989:2002, Programming language
COBOL:

Page 420, 14.8.4 CALL statement
2.

02-0070  –Restricted program pointer with AS phrase on
CALL stmt (Schricker)

http://www.cobolstandard.info/j4020070.htm
Defect Report Concerning:

Is the AS phrase allowed to override a restricted program pointer?  There is no rule that prohibits
it.

Consider, for example:
Should this CALL statement be legal?
Document Number:     J4/02-0116
2002-05-17
D-1.1           Page    2  of   3
Note that
SET pp-1 TO ADDRESS OF PROGRAM program-2

is invalid according to the syntax rules of the SET statement unless the signatures of program-1
and program-2 are the same.  Therefore, it would seem that this AS phrase should not be allowed
on the CALL statement unless the two signatures are the same, and in that case there is no need

for the AS phrase.
General rule 7 of the CALL statement, which applies to the format 3 (the program-prototype for-

mat) reads:

7) If the NESTED phrase is not specified, program-prototype-name-1, or the program prototype
specified in the definition of identifier-1 if it is defined as a restricted program-pointer, is used to de-

termine the characteristics of the called program.

This implies that specifying program-prototype-name-1 and specifying a restricted program-
pointer for identifier-1 are mutually exclusive.  Taken literally, it means that program-prototype-

name-1 is ignored if identifer-1 is a restricted program-pointer.  Why require program-prototype-
name-1 to be specified if it is to be ignored?  This seems like an error.

There are a couple of solutions that come to mind:
Solution 1 – New syntax

change the syntax diagram for format 3 of the CALL statement so that the first line reads:
 identifier-1

NESTED
 program-prototype-name-1

AS

 literal-1
 identifier-5

CALL
update the syntax rules so that
- identifier-5 is required to be a restricted program-pointer

- if identifier-1 is a program-pointer, it is not a restricted program-pointer.
Solution 2 – no change to the syntax, new syntax rule
Add a syntax rule so that when identifer-1 is a restricted program-pointer, it must be restricted to

program-prototype-name-1.  This seems very ugly.  There's no reason to specify the program
prototype when one has no choice as to what it is.

Summary
If we do nothing, either typing for program-pointers is broken or the user is required to specify

syntax that is ignored.  Implementations may differ in their interpretation.
I favor solution 1.

Discussion at Meeting 237
There was no concensus to make the changes for literal-1.
Document Number:     J4/02-0116
2002-05-17
D-1.1           Page    3  of   3

Since literal-1 always contains a program name and not a program-prototype name.  
the proposed rule introduces an unintended compile time check.

Proposed Response

There is a problem that in the case of a restricted program-pointer the current rules imply that the
specified prototype-name is ignored in the execution of the CALL statement. The prototype
specified in the definition of the program-pointer is used instead. A mismatch between those two
prototypes is permitted and will not be diagnosed as an error.

This problem will be submitted as a defect report.
The changes needed will be submitted as the proposed solution.

Changes Needed:

The following changes to reference 1, 18.8.4 CALL statement are proposed:
a)

Add new syntax rules for format 3:
13a) If identifier-1 references a restricted program-pointer, the signature of the program-

prototype specified in the definition of that pointer shall be the same as the signature of pro-
gram-prototype-name-1.

b)

Replace GR 7 by the following:
7) If the NESTED phrase is not specified, program-prototype-name-1 is used to determine the

characteristics of the called program.