STATIC CALL :
MAIN AND SUB PROGRAM EXECUTION :
MAIN PROGRAM:
IDENTIFICATION DIVISION.
PROGRAM-ID. MAINPROG.
DATA DIVISION.
*********************************************************************************
* THIS IS MAIN PROGRAM WHICH CALLS SUB PROGRAM
*********************************************************************************
WORKING-STORAGE SECTION.
01 WS-VARIABLES.
05 WS-INP-VAL PIC 9(06) VALUE ZEROS.
05 WS-OUT-VAL PIC 9(06) VALUE ZEROS.
PROCEDURE DIVISION.
MOVE 266500 TO WS-INP-VAL
DISPLAY 'WS-INP-VAL : ' WS-INP-VAL
CALL 'SUBPROG' USING WS-INP-VAL
MOVE WS-INP-VAL TO WS-OUT-VAL
DISPLAY 'WS-OUT-VAL : ' WS-OUT-VAL.
STOP RUN.
SUB PROGRAM:
IDENTIFICATION DIVISION.
PROGRAM-ID. SUBPROG.
DATA DIVISION.
*********************************************************************************
* THIS IS SUB PROGRAM WHICH IS CALLED FROM MAIN PROGRAM
*********************************************************************************
WORKING-STORAGE SECTION.
01 WS-VARIABLES.
05 WS-A PIC 9(06) VALUE ZEROS.
LINKAGE SECTION.
01 LK-VAR PIC 9(06) VALUE ZEROS.
PROCEDURE DIVISION USING LK-VAR.
MOVE 500 TO WS-A
DISPLAY 'WS-A : ' WS-A
DISPLAY 'LK-VAR : ' LK-VAR
COMPUTE LK-VAR = LK-VAR + WS-A
DISPLAY 'LK-VAR : ' LK-VAR.
GOBACK.
FIRST COMPILE AND LINK SUB PROGRAM:
JCL TO COMPILE AND LINK SUB PROGRAM:
//Z57658SA JOB (3P10),'SUBPROG COMP & LINK',
// CLASS=A,
// MSGCLASS=Q,
// NOTIFY=Z57658
//*
//SET1 SET MEM=SUBPROG
//SET2 SET SOURCE=Z57658.SOURCE.COBOL
//SET3 SET LOADLIB=Z57658.SOURCE.LOADLIB
//*
//COMPILE EXEC PGM=IGYCRCTL,REGION=0M
//STEPLIB DD DSNAME=IGY420.SIGYCOMP,DISP=SHR
// DD DSNAME=CEE.SCEERUN,DISP=SHR
// DD DSNAME=CEE.SCEERUN2,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DSN=&SOURCE(&MEM),DISP=SHR
//SYSLIN DD DSNAME=&&LOADSET,UNIT=SYSALLDA,
// DISP=(MOD,PASS),SPACE=(CYL,(1,1))
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT2 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT3 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT4 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT5 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT6 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT7 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT8 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT9 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT10 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT11 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT12 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT13 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT14 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT15 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSMDECK DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
//LKED EXEC PGM=IEWBLINK,
// COND=(8,LT,COMPILE),REGION=0M
//SYSLIB DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=&LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSLIN DD DSN=&&LOADSET,DISP=(OLD,DELETE)
// DD DDNAME=SYSIN
//SYSLMOD DD DSN=&LOADLIB(&MEM),DISP=SHR
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
COMPILE AND LINK MAIN PROGRAM:
JCL TO COMPILE AND LINK MAIN PROGRAM:
//Z57658SA JOB (3P10),'MAINPROG COMP & LINK',
// CLASS=A,
// MSGCLASS=Q,
// NOTIFY=Z57658
//*
//SET1 SET MEM=MAINPROG
//SET2 SET SOURCE=Z57658.SOURCE.COBOL
//SET3 SET LOADLIB=Z57658.SOURCE.LOADLIB
//*
//COMPILE EXEC PGM=IGYCRCTL,REGION=0M
//STEPLIB DD DSNAME=IGY420.SIGYCOMP,DISP=SHR
// DD DSNAME=CEE.SCEERUN,DISP=SHR
// DD DSNAME=CEE.SCEERUN2,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DSN=&SOURCE(&MEM),DISP=SHR
//SYSLIN DD DSNAME=&&LOADSET,UNIT=SYSALLDA,
// DISP=(MOD,PASS),SPACE=(CYL,(1,1))
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT2 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT3 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT4 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT5 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT6 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT7 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT8 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT9 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT10 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT11 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT12 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT13 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT14 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT15 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSMDECK DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
//LKED EXEC PGM=IEWBLINK,
// COND=(8,LT,COMPILE),REGION=0M
//SYSLIB DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=&LOADLIB,DISP=SHR
//PRIVLIB DD DSN=&LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSLIN DD DSN=&&LOADSET,DISP=(OLD,DELETE)
// DD *
INCLUDE PRIVLIB(SUBPROG)
ENTRY MAINPROG
NAME MAINPROG
//SYSLMOD DD DSN=&LOADLIB(&MEM),DISP=SHR
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
EXECUTE MAIN PROGRAM (It will execute both main and sub programs):
JCL TO RUN EXECUTE MAIN PROGRAM:
//Z57658SA JOB (3P10),'RUN MAIN PROGRAM',
// CLASS=A,
// MSGCLASS=Q,
// NOTIFY=Z57658
//*
//EXEC EXEC PGM=MAINPROG
//STEPLIB DD DSN=Z57658.SOURCE.LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//*
OUTPUT OF MAIN PROGRAM EXECUTION:
********************************* TOP OF DATA **
WS-INP-VAL : 266500
WS-A : 000500
LK-VAR : 266500
LK-VAR : 267000
WS-OUT-VAL : 267000
******************************** BOTTOM OF DATA
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
DYNAMIC CALL :
MAIN AND SUB PROGRAM EXECUTION :
MAIN PROGRAM:
IDENTIFICATION DIVISION.
PROGRAM-ID. DYMNPROG.
DATA DIVISION.
*********************************************************************************
* THIS IS MAIN PROGRAM WHICH CALLS SUB PROGRAM
*********************************************************************************
WORKING-STORAGE SECTION.
01 WS-VARIABLES.
05 WS-INP-VAL PIC 9(06) VALUE ZEROS.
05 WS-OUT-VAL PIC 9(06) VALUE ZEROS.
05 WS-PROG PIC X(08) VALUE 'DYSBPROG'.
PROCEDURE DIVISION.
MOVE 266500 TO WS-INP-VAL
DISPLAY 'WS-INP-VAL : ' WS-INP-VAL
CALL WS-PROG USING WS-INP-VAL
MOVE WS-INP-VAL TO WS-OUT-VAL
DISPLAY 'WS-OUT-VAL : ' WS-OUT-VAL
STOP RUN.
SUB PROGRAM:
IDENTIFICATION DIVISION.
PROGRAM-ID. DYSBPROG.
DATA DIVISION.
*********************************************************************************
* THIS IS SUB PROGRAM WHICH IS CALLED FROM MAIN PROGRAM
*********************************************************************************
WORKING-STORAGE SECTION.
01 WS-VARIABLES.
05 WS-A PIC 9(06) VALUE ZEROS.
LINKAGE SECTION.
01 LK-VAR PIC 9(06) VALUE ZEROS.
PROCEDURE DIVISION USING LK-VAR.
MOVE 500 TO WS-A
DISPLAY 'WS-A : ' WS-A
DISPLAY 'LK-VAR : ' LK-VAR
COMPUTE LK-VAR = LK-VAR + WS-A
DISPLAY 'LK-VAR : ' LK-VAR.
GOBACK.
FIRST COMPILE AND LINK SUB PROGRAM:
JCL TO COMPILE AND LINK SUB PROGRAM:
//Z57658SA JOB (3P10),'DY SUBPROG COMP-LINK',
// CLASS=A,
// MSGCLASS=Q,
// NOTIFY=Z57658
//*
//SET1 SET MEM=DYSBPROG
//SET2 SET SOURCE=Z57658.SOURCE.COBOL
//SET3 SET LOADLIB=Z57658.SOURCE.LOADLIB1
//*
//COMPILE EXEC PGM=IGYCRCTL,REGION=0M,
// PARM=(DYNAM)
//STEPLIB DD DSNAME=IGY420.SIGYCOMP,DISP=SHR
// DD DSNAME=CEE.SCEERUN,DISP=SHR
// DD DSNAME=CEE.SCEERUN2,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DSN=&SOURCE(&MEM),DISP=SHR
//SYSLIN DD DSNAME=&&LOADSET,UNIT=SYSALLDA,
// DISP=(MOD,PASS),SPACE=(CYL,(1,1))
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT2 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT3 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT4 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT5 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT6 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT7 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT8 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT9 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT10 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT11 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT12 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT13 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT14 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT15 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSMDECK DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
//LKED EXEC PGM=IEWBLINK,
// COND=(8,LT,COMPILE),REGION=0M
//SYSLIB DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=&LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSLIN DD DSN=&&LOADSET,DISP=(OLD,DELETE)
// DD DDNAME=SYSIN
//SYSLMOD DD DSN=&LOADLIB(&MEM),DISP=SHR
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
COMPILE AND LINK MAIN PROGRAM:
JCL TO COMPILE AND LINK MAIN PROGRAM:
//Z57658SA JOB (3P10),'DY MAINPROG COMP-LNK',
// CLASS=A,
// MSGCLASS=Q,
// NOTIFY=Z57658
//*
//SET1 SET MEM=DYMNPROG
//SET2 SET SOURCE=Z57658.SOURCE.COBOL
//SET3 SET LOADLIB=Z57658.SOURCE.LOADLIB1
//*
//COMPILE EXEC PGM=IGYCRCTL,REGION=0M
//STEPLIB DD DSNAME=IGY420.SIGYCOMP,DISP=SHR
// DD DSNAME=CEE.SCEERUN,DISP=SHR
// DD DSNAME=CEE.SCEERUN2,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSIN DD DSN=&SOURCE(&MEM),DISP=SHR
//SYSLIN DD DSNAME=&&LOADSET,UNIT=SYSALLDA,
// DISP=(MOD,PASS),SPACE=(CYL,(1,1))
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT2 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT3 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT4 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT5 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT6 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT7 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT8 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT9 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT10 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT11 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT12 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT13 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT14 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSUT15 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//SYSMDECK DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
//LKED EXEC PGM=IEWBLINK,
// COND=(8,LT,COMPILE),REGION=0M
//SYSLIB DD DSN=CEE.SCEELKED,DISP=SHR
// DD DSN=CEE.SCEELKEX,DISP=SHR
// DD DSN=&LOADLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSLIN DD DSN=&&LOADSET,DISP=(OLD,DELETE)
// DD DDNAME=SYSIN
//SYSLMOD DD DSN=&LOADLIB(&MEM),DISP=SHR
//SYSUT1 DD UNIT=SYSALLDA,SPACE=(CYL,(1,1))
//*
EXECUTE MAIN PROGRAM:
JCL TO EXECUTE MAIN PROGRAM:
//Z57658SA JOB (3P10),'RUN MAIN PROGRAM',
// CLASS=A,
// MSGCLASS=Q,
// NOTIFY=Z57658
//*
//EXEC EXEC PGM=DYMNPROG
//STEPLIB DD DSN=Z57658.SOURCE.LOADLIB1,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//*
OUTPUT OF MAIN PROGRAM EXECUTION:
********************************* TOP OF DATA ***
WS-INP-VAL : 266500
WS-A : 000500
LK-VAR : 266500
LK-VAR : 267000
WS-OUT-VAL : 267000
******************************** BOTTOM OF DATA *
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
No comments:
Post a Comment