Does a standalone cobol program need link editing?
Does a standalone cobol program need link editing?
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?
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?
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Does a standalone cobol program need link editing?
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.
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.
- Robert Sample
- Global Moderator
- Posts: 1903
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Does a standalone cobol program need link editing?
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?
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.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.
Re: Does a standalone cobol program need link editing?
Thanks Robert.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.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Does a standalone cobol program need link editing?
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
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute