Difference between an Object Module and Load Module

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
Shamik123
Member
Posts: 2
Joined: Fri May 23, 2008 1:39 pm

Difference between an Object Module and Load Module

Post by Shamik123 » Fri May 23, 2008 2:23 pm

Hi,

Let me start with the shortest COBOL program.

IDENTIFICATION DIVISION.
PROGRAM-ID. SHORTEST.
PROCEDURE DIVISION.
DISPLAY "THE SHORTEST COBOL PROGRAM IS OF 5 LINES".
STOP RUN.

We get the Object Module which contains the machine instructions when we compile the above 5 lines of source code.

My question is:
What is specific use of Link Edit in this case? The Link Editor in general resolves all the external references and transforms the Object Module in an executable Load Module form. What are the crucial differences between the Object Module and the Load Module of the above 5 lines of code? Please, let me know your opinion. I know that even the above Object Module cannot be directly run without beinf LinkEdited. But, I am not aware of the technical reason.

Please, help me. Thanking you a lot in anticipation.

With high regards,
Shamik Banerjee
Thanks & Regards,
Shamik Banerjee

chandana
Member
Posts: 6
Joined: Mon Jun 21, 2010 2:50 pm

Post by chandana » Thu Sep 30, 2010 12:59 pm

Hi ..
I also have the same doubt..
Please let me know if you have found the answer..

Thank you
Chandana

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Sep 30, 2010 1:39 pm

actually, you can remove the display instruction, and have a cobol prg with only 4 lines.

and join the 20th century of computing. stop using STOP RUN and start using GOBACK.

suggest you start by reading the following Redbooks z/os systems programming

it would be better for both of you to extend your knowledge by reading the documentation that exists,
than having any of us providing paraphrased (from what is already well written)
answers to 'select topics'.

The answer to this question, and probably many more that you have,
(possibly don't realize that you have)
is contained in the above publications in an easy to read manner.
Using the Redbook library allows you to 'evade'
the hard to read and sometimes obscurely organized Technical Manuals normally produced by IBM
and learn about the system that you are (or should be) becoming proficient.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Shamik123
Member
Posts: 2
Joined: Fri May 23, 2008 1:39 pm

Post by Shamik123 » Fri Oct 01, 2010 10:58 am

To answer Chandana's query: "The verb DISPLAY in COBOL generates a lot of code in mainframe Assembler. Included in it is a call to output your message. The link edit program pulls together the common routines necessary to actually define the location (SYSOUT by default on many systems), the methods used to actually output something and then to output it.

Go ahead and compile this and save both the object file and the results of the link edit. If you can read hex and know your way around a load module well enough, you'll see the routines added to the object file to support the DISPLAY. You can't run the object file because it doesn't have the other routines necessary to support the calls for service. That is what is in the link book."

Cheers,
Shamik Banerjee
Thanks & Regards,
Shamik Banerjee

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Fri Oct 01, 2010 3:07 pm

Shamik123 wrote:The link edit program pulls together the common routines necessary to actually define the location (SYSOUT by default on many systems)
Shamik123,
I suggested to you that you do some reading.
as you have decided to just pontificate on things you only know a little,
I am going to correct the above quote.

the actually definition of the output is accomplished in other SECTIONs of the COBOL program.
The default output is defined by the COBOL Program and not the OS.
the actual location is accomplished via ALLOCATE either (normally) thru DD Statements in your JCL or by dynamic allocation by a CALL from within the COBOL Program.

//SYSOUT DD SYSOUT=* << will drive to the sysout dsid in the spool.
//SYSOUT DD DSN=hlq.mlq.llq,DCB=(parms)

as you can see, your sysout can be directly written to a dataset.

so, the linkeditor (or binder) binds/completes CALLs to system output routines which will accomplish the actual i/o.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others