In COBOL, contained subprograms are not visible to other contained
subprograms by default. You must use the IS COMMON PROGRAM
clause to make a subprogram visible to other subprograms:
IDENTIFICATION DIVISION.
PROGRAM-ID. MAIN.
PROCEDURE DIVISION.
...
EXIT PROGRAM.
IDENTIFICATION DIVISION.
PROGRAM-ID. A.
* CAN CALL B
CALL B.
END-PROGRAM A.
IDENTIFICATION DIVISION.
PROGRAM-ID. B IS COMMON PROGRAM.
* CANNOT CALL A
CALL A
END-PROGRAM B.
END-PROGRAM MAIN.
The Java programming language has data hiding, but it is used to restrict access to methods
within a class from methods outside of the class. Class members
labeled as public are visible to any method in any other
class. Class members labeled as private are not
visible to any method in any other class.
copyright 1996-2000 Magelang Institute dba jGuru