Posted: Mon Dec 30, 2002 6:27 am Post subject: Expanding subprogram in compile listing
Hi,
Is there any way to expand the subprograms in compile listing? If a program calls three subprograms, I want to see all the three programs expanded in my listing. Is there any compiler option to achieve this?
Joined: 20 Dec 2002 Posts: 80 Topics: 21 Location: Chicago
Posted: Mon Dec 30, 2002 9:50 am Post subject:
Hi Narsimha,
if u r speaking about sub-programs,
Code:
In the PROCEDURE DIVISION, a program can call another program (generally called a subprogram in COBOL terms), and this called program can itself call other programs. The program that calls another program is referred to as the calling program, and the program it calls is referred to as the called program. When the called program processing is completed, the program can either transfer control back to the calling program or end the run unit
The sub-program can be called in 2 ways:
a) Static call
CALL "Program1" USING Variable-1
b) Dynamic call
MOVE 'Program1' TO WS-SUB-PROGRAM
CALL WS-SUB-PROGRAM USING Variable-1
The difference being, in Static calls, the load module will be link-edited into the called pgm's load module while in Dynamic call, the called subprogram is loaded into memory only at run time.
So, in both the cases, the chance of getting the listing in the called pgm's compiler output is non-existent! (since, at compile and link-editing time of the calling program only the load module of the sub-program is reqd).
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Dec 30, 2002 10:21 am Post subject:
Narsimha,
Here is a way for you to get the source listing of the subroutine along with the main program.
Put a copy statement before your call to the suroutine in the mainprogram.
ex:
Code:
*************************************************************
* START OF THE SOURCE OF SUBROUTINE 1 *
*************************************************************
COPY SUBROUTINE1.
*************************************************************
* END OF THE SOURCE OF SUBROUTINE 1 *
*************************************************************
CALL "sub-ROUTINE1" USING Variable-1
......
*************************************************************
* START OF THE SOURCE OF SUBROUTINE 2 *
*************************************************************
COPY SUBROUTINE2.
*************************************************************
* END OF THE SOURCE OF SUBROUTINE 2 *
*************************************************************
CALL "sub-ROUTINE2" USING Variable-1
.....
Now when you compile the main program you will also see the source for subroutines.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Thu Jan 02, 2003 10:14 am Post subject:
Anand_r,
Is the program PMDATEBC in the same source lib as the main program?? Check the compile JCL for SYSLIB dd and it should have the source lib of PMDATEBC as one of the concatenated DSN's.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Fri Jan 03, 2003 10:12 am Post subject:
Anand,
Try this sample JCL to compile to dummy program testa as well as copy the mainprogram,subroutine.I used the parm NOCOMPILE which will just do the syntax checking but will not create a object module.
You need to include your pds containing the mainprogram ,subroutines for the SYSLIB dsn. The end program clause will seperate the programs that are copied.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum