Difference between an Object Module and Load Module

Ask/Clarify the questions on ASSEMBLER language.

Moderator: Moderator Group

Post Reply
Shamik1976
Member
Posts: 2
Joined: Fri May 23, 2008 2:09 pm

Difference between an Object Module and Load Module

Post by Shamik1976 » Fri May 23, 2008 2:27 pm

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


Your Username is: Shamik321
Your Activation ID is: 1477507

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

DaveSter
Member
Posts: 1
Joined: Sat Dec 20, 2008 7:14 am
Location: MARYLAND

Post by DaveSter » Sat Dec 20, 2008 7:27 am

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.

BTW

The IEFBR14 utility used to be the shortest assembler language program around. It used to be one instruction

BR R14

but was changed some years ago to include saving and restoring the base registers. It's major use it to get rid of data files that will be created in the JCL or preallocate data files that will be needed by the JCl.

Shamik1976
Member
Posts: 2
Joined: Fri May 23, 2008 2:09 pm

Post by Shamik1976 » Sat Dec 20, 2008 11:34 am

Thank you very much for your help. Everything became crystal clear.

Cheers,
Shamik

JSchmitt
Member
Posts: 3
Joined: Wed Apr 28, 2010 9:34 pm

Post by JSchmitt » Wed Apr 28, 2010 9:41 pm

DaveSter wrote:BTW

The IEFBR14 utility used to be the shortest assembler language program around. It used to be one instruction

BR R14

but was changed some years ago to include saving and restoring the base registers. It's major use it to get rid of data files that will be created in the JCL or preallocate data files that will be needed by the JCl.
This simple assemly programm has an error. The value of register 15 will not been set to zero, so you may not got the proper return code of zero when the programm returns.

To may sure to get the returncode of zero you may write

SR R15,R15
BR R14

Best Regards:

Jochen Schmitt

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