IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How does the LINKER program locates the sub-program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Thu Oct 06, 2005 12:31 pm
Reply with quote

Question:When we compile and link a Cobol program, how does the LINKER program locates the sub-program (Called program) to be linked? By the PROGRAM-ID of the called program or by the member name (dsname) of the LOADLIB PDS.

For example the program that we are compiling contains this statement:

CALL 'ABC'.

Case 1:
Now if 'ABC' is the PROGRAM-ID of the program to be called, than how actually the LINKER program willl locate the sub-program to be linked. Where will it search for?

Case 2:
if 'A' has to be the member name in the LOADLIB PDS, then what is the use of PROGRAM-ID?

More:
That too how the same works in case of static and dynamic linking?

Please feel free to clarify the complete picture.
Back to top
View user's profile Send private message
Sridevi_C

Active User


Joined: 22 Sep 2005
Posts: 104
Location: Concord, New Hampshire, USA.

PostPosted: Fri Oct 07, 2005 7:11 pm
Reply with quote

Hi,
PROGRAM_ID entry of subprogram is for source code referenceses.Once subprogam is compiled, object program is it's identity,ie.,the member name of it's object code.This holds good for both static and dynamic call. Note:Source member name can be different from object code's member name,this can be done by JCL.In case of static call,while linkeditting the subprogram's object member name is searched for in the given PDS.
Hope this helps...
Sridevi.
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Sat Oct 08, 2005 3:01 pm
Reply with quote

Thanks Sridevi,

This makes things clear. I am just listing point the outcome of the discussion below. Correct if required.

(1) Once compiled dsname (load lib member name) acts as the programs identity. This applies in case is static and dynamic linking. Program-Id dosent plays any role in this case.
(2) If the called programs is a built-in program (written within the calling program), as possible in case of COBOL-85. In such case program-id of subprograms acts as its identity.
(3) Source code and the object code of a program can have different dsnames.

Note: I have used dsname in this coversation which is actually the member name of a PDS (loadlib or sourcelib).
Back to top
View user's profile Send private message
Sridevi_C

Active User


Joined: 22 Sep 2005
Posts: 104
Location: Concord, New Hampshire, USA.

PostPosted: Sat Oct 08, 2005 9:06 pm
Reply with quote

Hi umeshkmrsh,
Yep, you are correct,as per my knowledge.
Sridevi.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Oct 08, 2005 9:58 pm
Reply with quote

If you have access to a MF you can test this by linking the pgm w/a different member name than the pgm-id.

Then exec/call the pgm using either name to see what happens.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top