If a CALL statement includes a CONSTANT parameter, and a matching call prototype is defined, the equivalent parameter in the prototype must also include the CONSTANT clause (see p1 in the prototype); also, if the clause is used on a data item in a call prototype, the CONSTANT clause must also be specified for the corresponding parameter used in the sub-program (see p1 of subprog2).
program-id prototype is external.
linkage section.
01 p1 pic x(10). *> constant needed
01 p2 pic x(10) constant.
entry "subprog1" using reference p1.
entry "subprog2" using reference p2.
end program.
program-id. prog1.
01 a1 pic x(10) constant value "abcdefghij".
call "subprog1" using reference a1
end program.
program-id. "subprog2".
linkage section.
01 p1 pic x(10). *> constant needed
procedure division using p1.
goback.
end program.