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
Difference between an Object Module and Load Module
Moderator: Moderator Group
-
- Member
- Posts: 2
- Joined: Fri May 23, 2008 2:09 pm
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.
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.
-
- Member
- Posts: 2
- Joined: Fri May 23, 2008 2:09 pm
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.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.
To may sure to get the returncode of zero you may write
SR R15,R15
BR R14
Best Regards:
Jochen Schmitt
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page