View previous topic :: View next topic
|
Author |
Message |
umeshkmrsh
New User
Joined: 21 Sep 2005 Posts: 79 Location: India
|
|
|
|
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 |
|
|
Sridevi_C
Active User
Joined: 22 Sep 2005 Posts: 104 Location: Concord, New Hampshire, USA.
|
|
|
|
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 |
|
|
umeshkmrsh
New User
Joined: 21 Sep 2005 Posts: 79 Location: India
|
|
|
|
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 |
|
|
Sridevi_C
Active User
Joined: 22 Sep 2005 Posts: 104 Location: Concord, New Hampshire, USA.
|
|
|
|
Hi umeshkmrsh,
Yep, you are correct,as per my knowledge.
Sridevi. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|