Execution of COBOL code.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Neeraj N
Registered Member
Posts: 54
Joined: Tue Aug 20, 2013 12:49 pm

Execution of COBOL code.

Post 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?
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 825
Joined: Wed Sep 11, 2013 3:57 pm

Re: Execution of COBOL code.

Post by enrico-sorichetti »

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-)
Neeraj N
Registered Member
Posts: 54
Joined: Tue Aug 20, 2013 12:49 pm

Re: Execution of COBOL code.

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Execution of COBOL code.

Post 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.
User avatar
prino
Registered Member
Posts: 68
Joined: Sun Jun 01, 2014 4:15 am
Location: Vilnius, Lithuania
Contact:

Re: Execution of COBOL code.

Post 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?
Robert AH Prins
robertahprins @ the.17+Gb.Google thingy
Some z/OS code here
Neeraj N
Registered Member
Posts: 54
Joined: Tue Aug 20, 2013 12:49 pm

Re: Execution of COBOL code.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Execution of COBOL code.

Post 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).
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Execution of COBOL code.

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

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

Register

Sign in

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