Java Reference
In-Depth Information
FIGURE 1.2
A COBOL run unit.
The items passed in the USING clause are the parameters to the subroutine.
The subroutine can access any of the items that have been passed to it and can ac-
cess items in its own WORKING-STORAGE area. The MYSUBx-CONTROL areas
contain the results of the most recent call to MYSUB.
Note that while the main program can access items in the passed parameters, it
cannot access any items in the subroutine's WORKING-STORAGE area. Further,
Figure 1.2 shows two separate instances of MYSUBx-CONTROL data items but
only one instance of the MYSUB subroutine. This means that all of the items in
MYSUB's WORKING-STORAGE area will be shared, regardless of whether
MYSUB1-CONTROL or MYSUB2-CONTROL is passed. Because of this limita-
tion, the COBOL program does not behave exactly like an object.
In much the same way, a Java program contains any instances of the classes that
it creates. The major difference between a COBOL subroutine and a Java class is that
a Java program can contain many instances of its classes. These are called objects
(see Figure 1.3).
Search WWH ::




Custom Search