Page 1 of 1

Execution of COBOL code.

Posted: Tue Apr 04, 2017 2:12 pm
by Neeraj N
Hi,

Is there a way to understadn how a COBOL mainframe program executes line by line? So that we know what is happning by what code?

Re: Execution of COBOL code.

Posted: Tue Apr 04, 2017 2:57 pm
by enrico-sorichetti
google for cobol debuggers

Re: Execution of COBOL code.

Posted: Fri May 05, 2017 10:49 pm
by Neeraj N
That's a way but any debugger we need to purchase, is it possible to see execution in some freely available debugger on a desktop PC?

Re: Execution of COBOL code.

Posted: Fri May 05, 2017 11:51 pm
by Robert Sample
Google is your friend. Googling free cobol debugger returns about 325,000 hits. It looks like, from the first page of results, that there is at least one but I didn't click on the link to confirm that.

Re: Execution of COBOL code.

Posted: Fri May 12, 2017 12:54 am
by prino
Neeraj N wrote:Is there a way to understadn how a COBOL mainframe program executes line by line? So that we know what is happning by what code?
Real programmers know what is happening.

What would a debugger tell you if you traced "add a to b giving c" , or whatever the overlong syntax of COBOL requires?

Re: Execution of COBOL code.

Posted: Mon Jun 05, 2017 10:55 pm
by Neeraj N
I have been trying to understand if knowing the code behind the commands like MOVE and knowing Assembler can help me to understand COBOL better. As such it's not need for my career but to learn more.

Re: Execution of COBOL code.

Posted: Mon Jun 05, 2017 11:54 pm
by Robert Sample
Learning Assembler helps you understand what the COBOL code is doing and why sometimes there is a large difference in execution times based on the variables being used. Assembler knowledge helps in many areas of the mainframe.

I think this topic is pretty muddy at this point -- you started out asking about line-by-line execution of COBOL code (which requires a COBOL debugger) and now you're asking about Assembler. COBOL code is compiled into Assembler by the compiler, after which the assembled code runs through the linkage editor / binder to resolve calls to external modules (including COBOL subroutines among others), and out comes a load module that can be executed. A single COBOL statement may generate anywhere from one to many hundreds of Assembler statements so there is not a one-to-one correspondence between lines of COBOL and executed statements, and some statements (DISPLAY is a notable example) actually do most of their work in IBM subprograms that you can't see much of (since they are not provided as source code, only load modules).

Re: Execution of COBOL code.

Posted: Wed Jun 07, 2017 10:21 pm
by Anuj Dhawan
I agree with Robert. Line-by-line program execution and the underlying "generated assembler code" are two different animals in many ways - comparing them might end up as a futile effort.

On the other hand, if you are learning to debug the COBOL programs, you can use the COBOL compiler options shown in at this link in Table 1 to prepare your program for runtime debugging.