calling programs n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Calling programs PowerPoint Presentation
Download Presentation
Calling programs

Loading in 2 Seconds...

play fullscreen
1 / 10

Calling programs - PowerPoint PPT Presentation


  • 104 Views
  • Uploaded on

Calling programs. Fall 2012. Static vs Dynamic Calls. Calling Programs The program being called. Linkage Section Part of the Data Division, usually coded after the working-storage section. Defines the parameters being sent to the called program.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Calling programs' - terri


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
calling programs the program being called
Calling ProgramsThe program being called
  • Linkage Section
    • Part of the Data Division, usually coded after the working-storage section.
    • Defines the parameters being sent to the called program.
    • Only needed if parameters being passed to the program
calling programs the program being called1
Calling ProgramsThe program being called
  • Procedure Division Statement
    • Using clause
    • Only needed if parameters are passed to calling program.
  • Example:

Linkage Section.

01 PARM-Customer PIC X(10).

Procedure Division using PARM-Customer.

calling programs program being called
Calling ProgramsProgram being called
  • Must end with EXIT PROGRAM instead of STOP RUN.
  • Because … STOP RUN terminates the entire application
calling programs the program doing the calls
Calling ProgramsThe program doing the calls

Syntax:

CALL LINKAGE TYPE IS PROCEDURE/PROGRAM ‘programname’ USING parameter list

END-CALL.

PROCEDURE is used if the object being called is a *MODULE.

PROGRAM is used if the object being called is a *PGM.

USING is used only if parameters are passed.

slide7

CALL Statement with Parameters

Called Program

Identification Division

PROGRAM-ID. PGMB.

Data Division.

Linkage Section.

01 FLDX PIC X(2).

01 FLDY PIC 9(5).

Procedure Division

USING FLDX FLDY.

Calling Program

Data Division.

01 FLDA PIC X(2).

01 FLDB PIC 9(5).

Procedure Division.

CALL Linkage type

is program PGMB

USING FLDA FLDB.

slide8

CALL … BY CONTENT

  • Passes Parameters, but the values do not get returned to the calling program.
slide9

CALL … BY CONTENT

Calling Program

Called Programs

Identification Division.

PROGRAM-ID. SUBPGM1.

Procedure Division using FLDX

FLDY.

COMPUTE

FLDX = FLDY * 5.

PROGRAM EXIT.

Procedure Division.

MOVE 4 to FLDA.

MOVE 5 to FLDB.

CALL Linkage Type is

procedure ‘SUBPGM1’

USING FLDA

FLDB

CALL Linkage Type is

program ‘SUBPGM2’

USING BY CONTENT

FLDA FLDB

DISPLAY FLDA.

DISPLAY FLDB.

Identification Division.

PROGRAM-ID. SUBPGM2.

Procedure Division using FLDX

FLDY.

COMPUTE

FLDY = FLDX * 2.

PROGRAM EXIT.

combining modules
Combining Modules

Example

MODA *MODULE calls

MODB *MODULE

To create a program call MODCALL:

CRTPGM MODCALL MODULES(MODA MODB)