call
TRANSCRIPT
![Page 1: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/1.jpg)
![Page 2: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/2.jpg)
CALL CALL VerbVerb
A COBOL statement for accessing a subprogram.A COBOL statement for accessing a subprogram.
Called programCalled program is a subprogram or program called is a subprogram or program called into a user program as needed.into a user program as needed.
Calling programCalling program is a program that calls a subprogram. is a program that calls a subprogram.
CALL SyntaxCALL Syntax
![Page 3: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/3.jpg)
Call Call ParametersParameters
1. PROGNAME IDENTIFIER OR LITERAL1. PROGNAME IDENTIFIER OR LITERAL
It is possible not to specify the name of the called It is possible not to specify the name of the called subprogram as an explicit literal, as the following subprogram as an explicit literal, as the following example:example:
If response=“M” If response=“M”
move “MONTHLY” to sub-namemove “MONTHLY” to sub-name
elseelse
move “QUARTERLY” to sub-name.move “QUARTERLY” to sub-name.
CALL sub-name.CALL sub-name.
![Page 4: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/4.jpg)
Call Call ParametersParameters
USING BY CONTENT/REFERENCEUSING BY CONTENT/REFERENCE
1. BY REFERENCE1. BY REFERENCE This clause may be omitted, in which case it is This clause may be omitted, in which case it is
specified by default.specified by default. Means to associate subprogram data-names in the Means to associate subprogram data-names in the
linkage and procedure division using… linkage and procedure division using… specifications with the address of the specifications with the address of the corresponding data-names in the calling program.corresponding data-names in the calling program.
![Page 5: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/5.jpg)
Call Call ParametersParameters
USING BY CONTENT/REFERENCEUSING BY CONTENT/REFERENCE
2. BY CONTENT2. BY CONTENT The CALL statement makes available to the The CALL statement makes available to the
subprogram the content of the data-names listed in subprogram the content of the data-names listed in the CALL statement.the CALL statement.
The subprogram then does not make reference to The subprogram then does not make reference to the actual data-name storage locations in the the actual data-name storage locations in the calling program and cannot alter the contents of the calling program and cannot alter the contents of the data-names in the calling program.data-names in the calling program.
The calling program passes data, not references, to The calling program passes data, not references, to the called program.the called program.
CALL “STATS” USING BY CONTENT NO-OF-RECS,CALL “STATS” USING BY CONTENT NO-OF-RECS,
SALES-SALES-TABLE.TABLE.
![Page 6: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/6.jpg)
CALL CALL Example.Example.
IDENTIFICATION DIVISION.IDENTIFICATION DIVISION.PROGRAM-ID DateValidate IS INITIAL.PROGRAM-ID DateValidate IS INITIAL.DATA DIVISION.DATA DIVISION.WORKING-STORAGE SECTION.WORKING-STORAGE SECTION. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
LINKAGE SECTION.LINKAGE SECTION.01 DateParam PIC X(8).01 DateParam PIC X(8).01 DateResult PIC 9.01 DateResult PIC 9.
PROCEDURE DIVISION USING DateParam, DateResult.PROCEDURE DIVISION USING DateParam, DateResult.Begin. Begin. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? EXIT PROGRAM.EXIT PROGRAM.
??????.??????. ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ?
CALL "DateValidate"CALL "DateValidate"USING BY CONTENT TempDateUSING BY CONTENT TempDateUSING BY REFERENCE DateCheckResult.USING BY REFERENCE DateCheckResult.
![Page 7: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/7.jpg)
CALL CALL ParametersParameters
CALL "ProgramName" USING P1, P2, P3, P4.CALL "ProgramName" USING P1, P2, P3, P4.
PROCEDURE DIVISION USING P2, P4, P1, P3.PROCEDURE DIVISION USING P2, P4, P1, P3.
![Page 8: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/8.jpg)
CALL CALL ParametersParameters
CALL "ProgramName" USING P1, P2, P3, P4.CALL "ProgramName" USING P1, P2, P3, P4.
PROCEDURE DIVISION USING P2, P4, P1, P3.PROCEDURE DIVISION USING P2, P4, P1, P3.
Positions Correspond - Not NamesPositions Correspond - Not NamesPositions Correspond - Not NamesPositions Correspond - Not Names
![Page 9: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/9.jpg)
Parameter Passing Parameter Passing MechanismsMechanisms
CALL .. BYCALL .. BYREFERENCEREFERENCE
CALLedCALLedProgramProgram
![Page 10: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/10.jpg)
Parameter Passing Parameter Passing MechanismsMechanisms
CALL .. BYCALL .. BYREFERENCEREFERENCE
CALLedCALLedProgramProgram
Address of Address of
Data ItemData Item
DirectionDirectionof Data Flowof Data Flow
![Page 11: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/11.jpg)
Parameter Passing Parameter Passing MechanismsMechanisms
CALL .. BYCALL .. BYREFERENCEREFERENCE
CALLedCALLedProgramProgram
Address of Address of
Data ItemData Item
CALL .. BYCALL .. BYCONTENTCONTENT
CALLedCALLedProgramProgram
Copy ofCopy ofData ItemData Item
DirectionDirectionof Data Flowof Data Flow
![Page 12: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/12.jpg)
Parameter Passing Parameter Passing MechanismsMechanisms
CALL .. BYCALL .. BYREFERENCEREFERENCE
CALLedCALLedProgramProgram
Address of Address of
Data ItemData Item
CALL .. BYCALL .. BYCONTENTCONTENT
CALLedCALLedProgramProgram
Copy ofCopy ofData ItemData Item
Address of Address of CopyCopy
Data Data ItemItem
DirectionDirectionof Data Flowof Data Flow
DirectionDirectionof Data Flowof Data Flow
![Page 13: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/13.jpg)
Call Call ParametersParameters
ON OVERFLOWON OVERFLOW This conditional specifies execution of imperative-This conditional specifies execution of imperative-
statement-1 if the CALL cannot be executed statement-1 if the CALL cannot be executed because of insufficient storage, and the like.because of insufficient storage, and the like.
END-CALLEND-CALL This is a scope terminator that can be used as This is a scope terminator that can be used as
follows:follows:if N>zeroif N>zero
call “STATS” using…call “STATS” using…
on overflowon overflow
perform abcperform abc
move a to zmove a to z
end-callend-call
end-if.end-if.
![Page 14: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/14.jpg)
Called Program Called Program RequirementsRequirements
1. 1. PROGRAM-IDPROGRAM-ID In the calling program, we code In the calling program, we code CALL ‘literal-1’ USING …CALL ‘literal-1’ USING … In the called program, we code In the called program, we code PROGRAM-ID. literal-1.PROGRAM-ID. literal-1. With COBOL 85, the PROGRAM-ID paragraph of the called With COBOL 85, the PROGRAM-ID paragraph of the called
program may have the following program may have the following INITIAL PROGRAMINITIAL PROGRAM clause: clause:
PROGRAM-ID. Program-name [IS PROGRAM-ID. Program-name [IS INITIALINITIAL PROGRAM]. PROGRAM].
If this clause is used, the called program will be restored to its If this clause is used, the called program will be restored to its initial state each time it is called.initial state each time it is called.
This means that all identifiers in Working-storage will contain This means that all identifiers in Working-storage will contain their original values, as specified by their VALUE clauses, before their original values, as specified by their VALUE clauses, before and after each call.and after each call.
![Page 15: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/15.jpg)
Called Program Called Program RequirementsRequirements
2. 2. LINKAGE SECTIONLINKAGE SECTION
A Linkage Section must be defined in the called A Linkage Section must be defined in the called program for identifying those items that:program for identifying those items that:
(1) will be passed to the called program from the (1) will be passed to the called program from the calling program calling program
(2) passed back from the called program to the calling (2) passed back from the called program to the calling program.program.
The Linkage Section, if used, is coded after the File The Linkage Section, if used, is coded after the File and Working-storage Sections of the called program. and Working-storage Sections of the called program.
Similar to the Working-storage Section except that Similar to the Working-storage Section except that VALUE clauses for initializing fields are not permitted VALUE clauses for initializing fields are not permitted in the Linkage Section.in the Linkage Section.
![Page 16: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/16.jpg)
Called Program Called Program RequirementsRequirements
3. 3. PROCEDURE DIVISION USINGPROCEDURE DIVISION USING The identifiers specified in the USING clause in the PROCEDURE The identifiers specified in the USING clause in the PROCEDURE
DIVISION entry include all fields defined in the LINKAGE DIVISION entry include all fields defined in the LINKAGE SECTION; these identifiers will be passed from one program to SECTION; these identifiers will be passed from one program to the other.the other.
They passed to and from corresponding identifiers in the CALL … They passed to and from corresponding identifiers in the CALL … USING of the main program.USING of the main program.
4. 4. EXIT PROGRAMEXIT PROGRAM The last executed statement in the called program must be the The last executed statement in the called program must be the
EXIT PROGRAM. EXIT PROGRAM. It signals the computer to return control back to the calling It signals the computer to return control back to the calling
program.program.
![Page 17: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/17.jpg)
Avoiding “State Avoiding “State Memory” - The IS INITIAL Memory” - The IS INITIAL phrase.phrase.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Steadfast IS INITIALIS INITIAL.
DATA DIVISION.WORKING-STORAGE SECTION.01 RunningTotal PIC 9(7) VALUE 50.
LINKAGE SECTION.01 ParamValue PIC 99.
PROCEDURE DIVISION USING ParamValue.Begin. ADD ParamValue TO RunningTotal. DISPLAY "Total = ", RunningTotal. EXIT PROGRAM.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Steadfast IS INITIALIS INITIAL.
DATA DIVISION.WORKING-STORAGE SECTION.01 RunningTotal PIC 9(7) VALUE 50.
LINKAGE SECTION.01 ParamValue PIC 99.
PROCEDURE DIVISION USING ParamValue.Begin. ADD ParamValue TO RunningTotal. DISPLAY "Total = ", RunningTotal. EXIT PROGRAM.
1212
Total = 62Total = 62
55
Total = 55Total = 55
1212
Total = 62Total = 62
![Page 18: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/18.jpg)
Avoiding “State Memory” Avoiding “State Memory” - The IS INITIAL phrase.- The IS INITIAL phrase.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Fickle.
DATA DIVISION.WORKING-STORAGE SECTION.01 RunningTotal PIC 9(7) VALUE 50.
LINKAGE SECTION.01 ParamValue PIC 99.
PROCEDURE DIVISION USING ParamValue.Begin. ADD ParamValue TO RunningTotal. DISPLAY "Total = ", RunningTotal. EXIT PROGRAM.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Fickle.
DATA DIVISION.WORKING-STORAGE SECTION.01 RunningTotal PIC 9(7) VALUE 50.
LINKAGE SECTION.01 ParamValue PIC 99.
PROCEDURE DIVISION USING ParamValue.Begin. ADD ParamValue TO RunningTotal. DISPLAY "Total = ", RunningTotal. EXIT PROGRAM.
1212
Total = 62Total = 62
55
Total = 67Total = 67
1212
Total = 79Total = 79
![Page 19: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/19.jpg)
The CANCEL The CANCEL command.command.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Fickle.
DATA DIVISION.WORKING-STORAGE SECTION.01 RunningTotal PIC 9(7) VALUE 50.
LINKAGE SECTION.01 ParamValue PIC 99.
PROCEDURE DIVISION USING ParamValue.Begin. ADD ParamValue TO RunningTotal. DISPLAY "Total = ", RunningTotal. EXIT PROGRAM.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Fickle.
DATA DIVISION.WORKING-STORAGE SECTION.01 RunningTotal PIC 9(7) VALUE 50.
LINKAGE SECTION.01 ParamValue PIC 99.
PROCEDURE DIVISION USING ParamValue.Begin. ADD ParamValue TO RunningTotal. DISPLAY "Total = ", RunningTotal. EXIT PROGRAM.
1212
Total = 62Total = 62
1212
Total = 62Total = 62
CALL "Fickle" USING BY CONTENT IncValue.CALL "Fickle" USING BY CONTENT IncValue.CANCELCANCEL "Fickle""Fickle"CALL "Fickle" USING BY CONTENT IncValue.CALL "Fickle" USING BY CONTENT IncValue.
![Page 20: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/20.jpg)
Question?Question?
1. When subprograms are used, there must be one and 1. When subprograms are used, there must be one and only one ____ program but there may be several ____.only one ____ program but there may be several ____.
MAIN;SUBPROGRAMMAIN;SUBPROGRAM
2. The statement that terminates execution of the 2. The statement that terminates execution of the subprogram and returns execution to the statement subprogram and returns execution to the statement following the corresponding CALL statement is the ___ following the corresponding CALL statement is the ___ command.command.
EXIT PROGRAMEXIT PROGRAM
3. A called subprogram [can/cannot] itself include a CALL 3. A called subprogram [can/cannot] itself include a CALL statement that results in execution of another statement that results in execution of another subprogram. subprogram.
CanCan
4. A called subprogram [can/cannot] itself include a CALL 4. A called subprogram [can/cannot] itself include a CALL statement that results in execution of the main program.statement that results in execution of the main program.
CannotCannot
![Page 21: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/21.jpg)
Question?Question?
5. Because each subprogram has its own DATA DIVISION, 5. Because each subprogram has its own DATA DIVISION, and yet there are data that are to be used in both the and yet there are data that are to be used in both the main program and subprogram, the DATA DIVISION of main program and subprogram, the DATA DIVISION of the subprogram must include a special ____ SECTION the subprogram must include a special ____ SECTION to identify such data.to identify such data.
LINKAGE LINKAGE
6. For data that are used in both main program and 6. For data that are used in both main program and subprogram, the data names [must/need not] be the subprogram, the data names [must/need not] be the same in the two programs.same in the two programs.
Need notNeed not
7. For shared data items, what is important in the LINKAGE 7. For shared data items, what is important in the LINKAGE SECTION is the ___ description for each data-name.SECTION is the ___ description for each data-name.
PIC PIC
8. For shared data items, the order of the data-names in 8. For shared data items, the order of the data-names in the LINKAGE SECTION [is/is not] relevant.the LINKAGE SECTION [is/is not] relevant.
Is notIs not
![Page 22: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/22.jpg)
Contained Sub-Contained Sub-ProgramsPrograms
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.
PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? CALL PutToTable USING BY CONTENT DataItem ? ? ? ? ? ? ? ? ? CALL ReportFromTable. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ?END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable. ? ? ? ? ? ? ? ? ?END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.
PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? CALL PutToTable USING BY CONTENT DataItem ? ? ? ? ? ? ? ? ? CALL ReportFromTable. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ?END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable. ? ? ? ? ? ? ? ? ?END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
![Page 23: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/23.jpg)
Contained Sub-Contained Sub-ProgramsPrograms
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.
PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? CALL PutToTable USING BY CONTENT DataItem ? ? ? ? ? ? ? ? ? CALL ReportFromTable. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ?END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable. ? ? ? ? ? ? ? ? ?END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.
PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? CALL PutToTable USING BY CONTENT DataItem ? ? ? ? ? ? ? ? ? CALL ReportFromTable. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ?END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable. ? ? ? ? ? ? ? ? ?END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
![Page 24: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/24.jpg)
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.
PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? CALL PutToTable USING BY CONTENT DataItem ? ? ? ? ? ? ? ? ? CALL ReportFromTable. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ?END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable. ? ? ? ? ? ? ? ? ?END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.
PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? CALL PutToTable USING BY CONTENT DataItem ? ? ? ? ? ? ? ? ? CALL ReportFromTable. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ?END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable. ? ? ? ? ? ? ? ? ?END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
Contained Sub-Contained Sub-ProgramsPrograms
![Page 25: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/25.jpg)
The COMMON PROGRAM The COMMON PROGRAM PhrasePhrase
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ? CALL ReportFromTable. ? ? ? ? ? ? ? ? ? END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable IS COMMON PROGRAM. ? ? ? ? ? ? ? ? ? CALL PutToTable USING ???? ? ? ? ? ? ? ? ? ? END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ? CALL ReportFromTable. ? ? ? ? ? ? ? ? ? END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable IS COMMON PROGRAM. ? ? ? ? ? ? ? ? ? CALL PutToTable USING ???? ? ? ? ? ? ? ? ? ? END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
![Page 26: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/26.jpg)
The COMMON PROGRAM The COMMON PROGRAM PhrasePhrase
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ? CALL ReportFromTable. ? ? ? ? ? ? ? ? ? END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable IS COMMON PROGRAM. ? ? ? ? ? ? ? ? ? CALL PutToTable USING ???? ? ? ? ? ? ? ? ? ? END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ? CALL ReportFromTable. ? ? ? ? ? ? ? ? ? END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable IS COMMON PROGRAM. ? ? ? ? ? ? ? ? ? CALL PutToTable USING ???? ? ? ? ? ? ? ? ? ? END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
YESYES
![Page 27: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/27.jpg)
The COMMON PROGRAM The COMMON PROGRAM PhrasePhrase
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ? CALL ReportFromTable. ? ? ? ? ? ? ? ? ? END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable IS COMMON PROGRAM. ? ? ? ? ? ? ? ? ? CALL PutToTable USING ???? ? ? ? ? ? ? ? ? ? END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. MainProgram. ? ? ? ? ? ? ? ? ?01 TableItem IS GLOBALIS GLOBAL.PROCEDURE DIVISION. ? ? ? ? ? ? ? ? ? EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. PutToTable. ? ? ? ? ? ? ? ? ? CALL ReportFromTable. ? ? ? ? ? ? ? ? ? END-PROGRAM PutToTable.
IDENTIFICATION DIVISION.PROGRAM-ID. ReportFromTable IS COMMON PROGRAM. ? ? ? ? ? ? ? ? ? CALL PutToTable USING ???? ? ? ? ? ? ? ? ? ? END-PROGRAM ReportFromTable.END-PROGRAM MainProgram.
YESYES
NONO
![Page 28: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/28.jpg)
Creating Abstract Data Creating Abstract Data Types?Types?
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Stack.DATA DIVISION.WORKING-STORAGE SECTION.01 StackHolder IS GLOBAL. 02 StackItem OCCURS 20 TIMES PIC X(10).PROCEDURE DIVISION USING ????.Begin. EVALUATE TRUE WHEN PushStack CALL "Push" USING ??? WHEN PopStack CALL "Pop" USING ??? END-EVALUATE. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. Push. ? ? ? ? ? ? ? ? ?END-PROGRAM Push.
IDENTIFICATION DIVISION.PROGRAM-ID. Pop. ? ? ? ? ? ? ? ? ?END-PROGRAM Pop.END-PROGRAM Stack.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Stack.DATA DIVISION.WORKING-STORAGE SECTION.01 StackHolder IS GLOBAL. 02 StackItem OCCURS 20 TIMES PIC X(10).PROCEDURE DIVISION USING ????.Begin. EVALUATE TRUE WHEN PushStack CALL "Push" USING ??? WHEN PopStack CALL "Pop" USING ??? END-EVALUATE. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. Push. ? ? ? ? ? ? ? ? ?END-PROGRAM Push.
IDENTIFICATION DIVISION.PROGRAM-ID. Pop. ? ? ? ? ? ? ? ? ?END-PROGRAM Pop.END-PROGRAM Stack.
StackStack
PushPush
PopPop
MainMain
![Page 29: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/29.jpg)
Creating Abstract Data Creating Abstract Data Types?Types?
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Stack.DATA DIVISION.WORKING-STORAGE SECTION.01 StackHolder IS GLOBAL. 02 StackItem OCCURS 20 TIMES PIC X(10).PROCEDURE DIVISION USING ????.Begin. EVALUATE TRUE WHEN PushStack CALL "Push" USING ??? WHEN PopStack CALL "Pop" USING ??? END-EVALUATE. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. Push. ? ? ? ? ? ? ? ? ?END-PROGRAM Push.
IDENTIFICATION DIVISION.PROGRAM-ID. Pop. ? ? ? ? ? ? ? ? ?END-PROGRAM Pop.END-PROGRAM Stack.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Stack.DATA DIVISION.WORKING-STORAGE SECTION.01 StackHolder IS GLOBAL. 02 StackItem OCCURS 20 TIMES PIC X(10).PROCEDURE DIVISION USING ????.Begin. EVALUATE TRUE WHEN PushStack CALL "Push" USING ??? WHEN PopStack CALL "Pop" USING ??? END-EVALUATE. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. Push. ? ? ? ? ? ? ? ? ?END-PROGRAM Push.
IDENTIFICATION DIVISION.PROGRAM-ID. Pop. ? ? ? ? ? ? ? ? ?END-PROGRAM Pop.END-PROGRAM Stack.
StackStack
PushPush
PopPop
MainMain
![Page 30: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/30.jpg)
Creating Abstract Data Creating Abstract Data Types?Types?
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Stack.DATA DIVISION.WORKING-STORAGE SECTION.01 StackHolder IS GLOBAL. 02 StackItem OCCURS 20 TIMES PIC X(10).PROCEDURE DIVISION USING ????.Begin. EVALUATE TRUE WHEN PushStack CALL "Push" USING ??? WHEN PopStack CALL "Pop" USING ??? END-EVALUATE. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. Push. ? ? ? ? ? ? ? ? ?END-PROGRAM Push.
IDENTIFICATION DIVISION.PROGRAM-ID. Pop. ? ? ? ? ? ? ? ? ?END-PROGRAM Pop.END-PROGRAM Stack.
$ SET SOURCEFORMAT"FREE"IDENTIFICATION DIVISION.PROGRAM-ID. Stack.DATA DIVISION.WORKING-STORAGE SECTION.01 StackHolder IS GLOBAL. 02 StackItem OCCURS 20 TIMES PIC X(10).PROCEDURE DIVISION USING ????.Begin. EVALUATE TRUE WHEN PushStack CALL "Push" USING ??? WHEN PopStack CALL "Pop" USING ??? END-EVALUATE. EXIT PROGRAM.
IDENTIFICATION DIVISION.PROGRAM-ID. Push. ? ? ? ? ? ? ? ? ?END-PROGRAM Push.
IDENTIFICATION DIVISION.PROGRAM-ID. Pop. ? ? ? ? ? ? ? ? ?END-PROGRAM Pop.END-PROGRAM Stack.
StackStack
PushPush
PopPop
MainMain
![Page 31: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/31.jpg)
The IS EXTERNAL The IS EXTERNAL phrase.phrase.
FD CommonFileArea IS EXTERNAL.
WORKING-STORAGE SECTION.01 SharedRec IS EXTERNAL. 02 PartA PIC X(4). 02 PartB PIC 9(5).
![Page 32: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/32.jpg)
The IS EXTERNAL The IS EXTERNAL phrase.phrase.
WORKING-STORAGE SECTION.01 SharedRec IS EXTERNAL. 02 PartA PIC X(4). 02 PartB PIC 9(5).
ProgramAProgramA
01 SharedRec etc01 SharedRec etc
ProgramDProgramDProgramCProgramC01 SharedRec etc01 SharedRec etc
ProgramBProgramB
SharedRecSharedRec
Mike12345Mike12345
![Page 33: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/33.jpg)
The IS EXTERNAL The IS EXTERNAL phrase.phrase.
WORKING-STORAGE SECTION.01 SharedRec IS EXTERNAL. 02 PartA PIC X(4). 02 PartB PIC 9(5).
ProgramAProgramA
01 SharedRec etc01 SharedRec etc
ProgramDProgramDProgramCProgramC01 SharedRec etc01 SharedRec etc
ProgramBProgramB
SharedRecSharedRecPUTPUT
Mike12345Mike12345
Mike12345Mike12345
![Page 34: Call](https://reader036.vdocuments.us/reader036/viewer/2022070319/55814a0ed8b42ab9548b4688/html5/thumbnails/34.jpg)
The IS EXTERNAL The IS EXTERNAL phrase.phrase.
WORKING-STORAGE SECTION.01 SharedRec IS EXTERNAL. 02 PartA PIC X(4). 02 PartB PIC 9(5).
ProgramAProgramA
01 SharedRec etc01 SharedRec etc
ProgramDProgramDProgramCProgramC01 SharedRec etc01 SharedRec etc
ProgramBProgramB
SharedRecSharedRecPUTPUT GETGET
Mike12345Mike12345
Mike12345Mike12345
Mike12345Mike12345