Execution of COBOL code.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Previous topicNext topic

Topic author
Neeraj N
Registered Member
Posts: 36
Joined: Tue Aug 20, 2013 12:49 pm

Execution of COBOL code.

Post by Neeraj N » Tue Apr 04, 2017 2:12 pm

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?




enrico-sorichetti
Global Moderator
Global Moderator
Posts: 836
Joined: Wed Sep 11, 2013 3:57 pm

Re: Execution of COBOL code.

Post by enrico-sorichetti » Tue Apr 04, 2017 2:57 pm

google for cobol debuggers


cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)


Topic author
Neeraj N
Registered Member
Posts: 36
Joined: Tue Aug 20, 2013 12:49 pm

Re: Execution of COBOL code.

Post by Neeraj N » Fri May 05, 2017 10:49 pm

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?



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1289
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa

Re: Execution of COBOL code.

Post by Robert Sample » Fri May 05, 2017 11:51 pm

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.



User avatar

prino
Registered Member
Posts: 54
Joined: Sun Jun 01, 2014 4:15 am
Location: Oostende, Belgium

Re: Execution of COBOL code.

Post by prino » Fri May 12, 2017 12:54 am

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?


Robert AH Prins
robertahprins @ the.17+Gb.Google thingy


Topic author
Neeraj N
Registered Member
Posts: 36
Joined: Tue Aug 20, 2013 12:49 pm

Re: Execution of COBOL code.

Post by Neeraj N » Mon Jun 05, 2017 10:55 pm

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.



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1289
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa

Re: Execution of COBOL code.

Post by Robert Sample » Mon Jun 05, 2017 11:54 pm

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).



User avatar

Anuj Dhawan
Founder
Posts: 2418
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India

Re: Execution of COBOL code.

Post by Anuj Dhawan » Wed Jun 07, 2017 10:21 pm

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.


Thanks,
Anuj

Previous topicNext topic

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”