Page 1 of 1

Does a standalone cobol program need link editing?

Posted: Wed Aug 19, 2015 12:56 pm
by RoyW
Hi,

I know that for preparing a COBOL program before executing using a RUN JCL, we need to compile the program and then link edit it so that we have a load module which can be executed using the JCL. But I have the confusion that if we have only one cobol program which is stand alone, then do we need to link edit it before it can be executed?

Re: Does a standalone cobol program need link editing?

Posted: Wed Aug 19, 2015 3:53 pm
by William Collins
Yes, you do.

The compiler produces an "object deck". An object-deck is not executable.

The linkage-editor/binder is producing a loadmodule, using object-decks and loadmodules as input, even when there is only one of the former and none of the latter.

With COBOL V5, loadmodules are no longer used (instead exclusively Program Objects are produced) but the principle is the same. The compiler does not produce code that is directly executable.

Re: Does a standalone cobol program need link editing?

Posted: Wed Aug 19, 2015 6:17 pm
by Robert Sample
If you look at the pseudo-assembler code produced by the COBOL compiler, you will notice that COBOL has a number of run-time routines that are invoked (the DISPLAY statement has a run-time routine, for example, so every DISPLAY statement will use the system routine). These run-time routines need to be included into the load module before the program will successfully execute. This is one of the reasons every COBOL program has to go through the linkage editor / binder before it can be executed. As was mentioned, another reason is that the COBOL compiler produces object code and not executable code.

Re: Does a standalone cobol program need link editing?

Posted: Mon Sep 07, 2015 3:28 pm
by RoyW
William Collins wrote:With COBOL V5, loadmodules are no longer used (instead exclusively Program Objects are produced) but the principle is the same. The compiler does not produce code that is directly executable.
Then how do we execute the programs now in JCL? Are we not going to use PGM=pgm in the JCL now? We are still not using COBOL V5.

Re: Does a standalone cobol program need link editing?

Posted: Mon Sep 07, 2015 3:28 pm
by RoyW
Robert Sample wrote:If you look at the pseudo-assembler code produced by the COBOL compiler, you will notice that COBOL has a number of run-time routines that are invoked (the DISPLAY statement has a run-time routine, for example, so every DISPLAY statement will use the system routine). These run-time routines need to be included into the load module before the program will successfully execute. This is one of the reasons every COBOL program has to go through the linkage editor / binder before it can be executed. As was mentioned, another reason is that the COBOL compiler produces object code and not executable code.
Thanks Robert.

Re: Does a standalone cobol program need link editing?

Posted: Mon Sep 07, 2015 3:32 pm
by William Collins
Don't worry, you still execute programs in the same way.
With COBOL V5, loadmodules are no longer used (instead exclusively Program Objects are produced) but the principle is the same
.