Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How does the LINKER program locates the sub-program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How does the LINKER program locates the sub-program
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    Post subject:
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    Post subject:
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    Post subject: Re: How does the LINKER program locates the sub-program
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us