MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Expanding subprogram in compile listing

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Narsimha
Beginner


Joined: 03 Dec 2002
Posts: 27
Topics: 14

PostPosted: Mon Dec 30, 2002 6:27 am    Post subject: Expanding subprogram in compile listing Reply with quote

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?

Thanks,
Narsimha
Back to top
View user's profile Send private message
Himesh
CICS Forum Moderator
CICS Forum Moderator


Joined: 20 Dec 2002
Posts: 80
Topics: 21
Location: Chicago

PostPosted: Mon Dec 30, 2002 9:50 am    Post subject: Reply with quote

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).

Himesh
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12368
Topics: 75
Location: San Jose

PostPosted: Mon Dec 30, 2002 10:21 am    Post subject: Reply with quote

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.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Mon Dec 30, 2002 11:52 am    Post subject: Reply with quote

Question Won't the subroutine code also try to compile? Surely this will generate many error messages.

Bill
Back to top
View user's profile Send private message
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Thu Jan 02, 2003 6:21 am    Post subject: Reply with quote

Kolusu,

I was trying the solution that you have suggested.. But it's not working.. I am pasting my code here.. Please lemme know what was my mistake..


MOVE 0001 TO PM4C-DATE-REQUEST-CODE.
COPY PMDATEBC
CALL 'PMDATEBC' USING PM0004CR.
MOVE PM4C-DATE-REPORT-YEAR TO WS-CURRENT-YEAR.
COMPUTE WS-PRIOR-YEAR = WS-CURRENT-YEAR - 1.

The bold one (COPY PMDATEBC) I have added, but it's not getting included in the source list(SYSPRINT of the compiled job) ..

Anand
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12368
Topics: 75
Location: San Jose

PostPosted: Thu Jan 02, 2003 10:14 am    Post subject: Reply with quote

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.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Fri Jan 03, 2003 7:52 am    Post subject: Reply with quote

Kolusu,


I copied that PMDATEBC into the main module pds.. and I compiled again,,but it was not getting included in the syslist..

Pls let me know..

Thx
Anand
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12368
Topics: 75
Location: San Jose

PostPosted: Fri Jan 03, 2003 10:12 am    Post subject: Reply with quote

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.

Code:

//STEP0100 EXEC PGM=IGYCRCTL,                                         
//             PARM=('NOCOMPILE,RENT,NOSEQ,LIB,MAP,OFFSET,XREF(FULL)')
//STEPLIB  DD  DSN=SYS1.SIGYCOMP,                                     
//             DISP=SHR                                               
//SYSPRINT  DD SYSOUT=*                                               
//SYSTERM   DD SYSOUT=*                                               
//SYSUT1    DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)                       
//SYSUT2    DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)                       
//SYSUT3    DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)                       
//SYSUT4    DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)                       
//SYSUT5    DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)                       
//SYSUT6    DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)                       
//SYSUT7    DD UNIT=DISK,SPACE=(CYL,(10,2),RLSE)                       
//SYSLIN    DD SYSOUT=*                                               
//SYSLIB    DD DSN=YOUR.SOURCE.PROGRAM.PDS,                               
//             DISP=SHR                                               
//SYSIN    DD  * 
        IDENTIFICATION DIVISION.             
        PROGRAM-ID.    TESTA                 
        DATE-COMPILED.                       
        ENVIRONMENT DIVISION.               
        CONFIGURATION SECTION.               
        INPUT-OUTPUT SECTION.               
        FILE-CONTROL.                       
        DATA DIVISION.                       
        FILE SECTION.                       
        WORKING-STORAGE SECTION.             
                                             
        PROCEDURE DIVISION.                 
                                             
                GOBACK.                     
                                             
        END PROGRAM TESTA.                   
                                             
               COPY MAINPGM.                   
        END PROGRAM MAINPGM.                 
                                             
               COPY SUBRT1.                 
        END PROGRAM SUBRT1.                 
                                             
               COPY SUBRT2.                 
        END PROGRAM SUBRT2.                 

/*                                                                   


Now check your SYSPRINT and all the programs are expanded.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group