IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Interview question which I failed to answer.


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arindambanerjee

New User


Joined: 30 Jun 2007
Posts: 39
Location: India

PostPosted: Sat Jul 11, 2009 7:37 pm
Reply with quote

Hi,

I have been asked a question in an interview as below:

CASE1:
....
A0-section.
......
Perform AB-para.
...
...

A0-Exit
Exit.


AB-Para.
...
...
Perform D-para.
....
AB-para-end.
exit.

CASE2:

...
A0-section.
......
Perform AB-para thru AB-para-end.
...
...

A0-Exit
Exit.


AB-Para.
...
...
Perform D-para.
....
AB-para-end.
exit.


D-Para is there in the code as well.
the question was whats the difference between these two cases and if there is no difference then what will be the flow.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Sat Jul 11, 2009 8:54 pm
Reply with quote

Have you reviewed the COBOL Language Reference (manuals link at the top of the page) on the PERFORM statement?

PERFORM paragraph performs only that paragraph. So case 1 would execute the PERFORM, then A8-Para, then D-para, then at the end of A8-Para would return to A0-section and continue. If there's no program exit, control would fall through A0-Exit and start executing A8-Para and so forth.

The main difference in case 2 in that execution would go through the end paragraph, but otherwise there's no difference in execution sequence.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Jul 13, 2009 3:01 pm
Reply with quote

There is no difference in both the approaches from execution per se as Robert has said; though at some shops coding "..thru AB-para-end" in "Perform AB-para thru AB-para-end" comes under coding standards. Every PARA should end with an EXIT though period (.) in place of EXIT would also do the same.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts DFHPI1008 JSON generation failed COBOL Programming 0
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
Search our Forums:

Back to Top