technology blog of unnikrishnan

Friday, March 09, 2007

The following is the IGYWCL procedure which calls the cobol compiler IGYCRCTL (In line 04 ) . Now let us see
how we can modify it to make the CALL statement work with this procedure

————————————————-IGYWCL—————————————————–
01 //IGYWCL PROC LNGPRFX=’IGY310′,SYSLBLK=3200,
02 // LIBPRFX=’CEE’,
03 // PGMLIB=’&&GOSET’,GOPGM=GO
04 //COBOL EXEC PGM=IGYCRCTL,REGION=2048K
05 //STEPLIB DD DSNAME=&LNGPRFX..SIGYCOMP,
06 // DISP=SHR
07 //SYSPRINT DD SYSOUT=*
08 //SYSLIN DD DSNAME=&&LOADSET,UNIT=SYSDA,
09 // DISP=(MOD,PASS),SPACE=(TRK,(3,3)),
10 // DCB=(BLKSIZE=&SYSLBLK)
11 //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
12 //SYSUT2 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
13 //SYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
14 //SYSUT4 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
15 //SYSUT5 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
16 //SYSUT6 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
17 //SYSUT7 DD UNIT=SYSDA,SPACE=(CYL,(1,1))
18 //LKED EXEC PGM=HEWL,COND=(4,LE),REGION=1024K
19 //SYSLIB DD DSNAME=&LIBPRFX..SCEELKED,
20 // DISP=SHR
21 //SYSPRINT DD SYSOUT=*
22 //SYSLIN DD DSNAME=&&LOADSET,DISP=(OLD,DELETE)
23 // DD DDNAME=SYSIN
24 //SYSLMOD DD DSNAME=&PGMLIB(&GOPGM),
25 // SPACE=(TRK,(10,10,1)),
26 // UNIT=SYSDA,DISP=(MOD,PASS)
27 //SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(10,10))
——————————————————————————————————————-

In this procedure line 01 to 17 is compiler procedure and line 18 to 27 is used for link edit. The line 19 is to identify syslib
syslib is the system library here it is CEE.SCEELKED where the cobol compiler link edit files reside .

Ok now we will see how The CALL statement will impliment

First create a main cobol file let the content in main be

01 ID DIVISION.
02 PROGRAM-ID. MAIN.
03 DATA DIVISION.
04 PROCEDURE DIVISION.
05 MAIN.
06 DISPLAY ‘THIS IS FROM MAIN PROG’.
07 CALL ‘SUB’.
08 STOP RUN.

Create a sub program let it be

01 ID DIVISION.
02 PROGRAM-ID. SUB.
03 PROCEDURE DIVISION.
04 MAIN.
05 DISPLAY ‘I AM FROM SUB’.
06 EXIT PROGRAM.

Compile sub program first and put the load module in say ESCUB12.UNNI.LOAD then compile main but you
will get an error saying that Module sub unresolvable it is because the module sub is not in SYSLIB
to remove this error create a jcl to compile main as like below

1 //COMPIL JOB NOTIFY=&SYSUID,CLASS=A,
2 // MSGCLASS=H,MSGLEVEL=(1,1),LINES=(1,CANCEL)
3 //JOBPROC JCLLIB ORDER=SYS2.SAMPLE.PROCLIB ** DO NOT CHANGE **
4 //COBC EXEC IGYWCL,
5 // PGMLIB=ESCUB22.UNNI.LOAD,
6 // GOPGM=MAIN
7 //COBOL.SYSIN DD DSN=ESCUB12.UNNI.PDS(MAIN),DISP=SHR
8 //LKED.SYSLIB DD DSN=ESCUB12.UNNI.LOAD,DISP=SHR
9 // DD DSN=CEE.SCEELKED,DISP=SHR

See line 8 and 9 we are overriding the SYSLIB in IGYWCL and creating a new syslib That is concatenated PDS of
the load library of SUB and the SYSTEM LIBRARY
Now compile MAIN hope your Main program resides in ESCUB12.UNNI.PDS
After compiling main run the load module main hope you will get the following result
—————————————————–
THIS IS FROM MAIN PROG
I AM FROM SUB
——————————————————

Labels: , , ,

0 Comments:

Post a Comment

<< Home