This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL
Moderators: dbzTHEdinosauer , Moderator Group
nikilkarna
Member
Posts: 2 Joined: Thu Dec 16, 2010 2:08 am
Location: IN
Post
by nikilkarna » Thu Dec 16, 2010 2:20 am
can some one explain the flow of this one?
Code: Select all
procedure division.
TopLevel.
DISPLAY "In TopLevel. Starting to run program"
PERFORM OneLevelDown
DISPLAY "Back in TopLevel.".
STOP RUN.
TwoLevelsDown.
DISPLAY " Now in TwoLevelsDown."
PERFORM ThreeLevelsDown.
DISPLAY " Back in TwoLevelsDown.".
OneLevelDown.
DISPLAY " Now in OneLevelDown"
PERFORM TwoLevelsDown
DISPLAY " Back in OneLevelDown".
ThreeLevelsDown.
DISPLAY " Now in ThreeLevelsDown".
[ CODE ] [ / code ] tags added by dbz
refer
here for explanation of BBCode
dbzTHEdinosauer
Moderator
Posts: 981 Joined: Mon Oct 02, 2006 8:31 pm
Post
by dbzTHEdinosauer » Thu Dec 16, 2010 2:07 pm
nikilkarna wrote: can some one explain the flow of this one?
what is the output when you run the program?
each paragraph has a
DISPLAY enter paragraph PERFORM someother-para DISPLAY exit (back in) paragraph
rather straight forward.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Vamsi99
Active Member
Posts: 183 Joined: Wed Nov 05, 2008 11:20 am
Post
by Vamsi99 » Thu Dec 16, 2010 3:46 pm
TopLevel para executes Oneleveldown para.. in which it will call .. twoleveldown para.. in whcih it will call Threeleveldown para...
Might be .. this is an example.. to explain.. how PERFORM will work in COBOL.
and how control pass thru this program.
When you run.. based on output you can understand how control passed between threse paras.
PERFORM - It will execute the sepcified para and control return back to next statement after PERFORM.
nikilkarna
Member
Posts: 2 Joined: Thu Dec 16, 2010 2:08 am
Location: IN
Post
by nikilkarna » Thu Dec 16, 2010 7:19 pm
i need output of this program and the control flow. As vamsi said that it will execute the specific para(OneLevelDown) and will the control comes back to statement(display in the para and stop run will encounter) or will it pass to the next statement(next perform).
dbzTHEdinosauer
Moderator
Posts: 981 Joined: Mon Oct 02, 2006 8:31 pm
Post
by dbzTHEdinosauer » Thu Dec 16, 2010 7:28 pm
nikilkarna,
you need to RTFM and learn basics for COBOL. Learn about the Perform Statement.
compile and execute the program and gather your own output.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
Anuj Dhawan
Moderator
Posts: 1625 Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India
Post
by Anuj Dhawan » Tue Dec 28, 2010 12:42 pm
I agree with Dick and suggest to compile/execute the program to know (understand) the flow of the Program.
And why don't you do it (compile/execute) as the first thing, by the way!
Regards,
Anuj
Free tutorials from mainframegurukul
JCL Tutorial Covers all important JCL concepts.
Cobol Tutorial This tutorials covers all Cobol Topics from STRING to COMP-3.
DB2 Tutorial DB2 Tutorial focuses on DB2 COBOL Programming.
SORT Tutorial This Tutorial covers all important aspects of DFSORT with examples
CICS Tutorial This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Mainframe Interview questions
Mainframe Tools and others