Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
PERFORM PARA vs PERFORM PARA THRU EXIT-PARA

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Wed Feb 25, 2009 4:23 pm    Post subject: PERFORM PARA vs PERFORM PARA THRU EXIT-PARA
Reply with quote

Need a clarification on coding Perform PARA Vs Perform Para Thru Exit-Para.

In our shop, the usual standard to call a Para is as below. This code will call Para 1000-PARA and execute until 1000-EXIT and the control returns to the next statement of PERFORM.

Code:

PERFORM 1000-PARA THRU 1000-EXIT.
.
.
.
1000-PARA.
 Code within Para.

1000-EXIT.
EXIT.


My doubt is, there was a code as below. Need to know how the control flows in this case.

Code:
PERFORM 1000-PARA.

.
.
1000-PARA.
 Code within Para.

2000-PARA.
 Code within Para.


Please clarify, let me know for more detail.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Feb 25, 2009 4:50 pm    Post subject:
Reply with quote

The code within 1000-PARA will be executed, after which control returns to the statement after the PERFORM -- the code in 2000-PARA will not be executed via the PERFORM. However, if control falls into 1000-PARA without being executed via a PERFORM, the code in 2000-PARA would be executed since sequential flow control would ensue.
Back to top
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Wed Feb 25, 2009 5:09 pm    Post subject:
Reply with quote

Thanks for clarifying Bob.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Feb 25, 2009 10:08 pm    Post subject:
Reply with quote

Each shop has its own standards. One "gotcha" to be aware of is when copying a paragraph and its exit to another area of the source and modifying the paragraph names, some people forget to change the exit paragraph name also. Can't tell you how many times this has happened to others (and myself on occasion icon_sad.gif ). In other words try performing 2000-NEW-PARAGRAPH THRU 1000-EXIT sometime and watch what happens!
Back to top
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Thu Feb 26, 2009 10:57 am    Post subject:
Reply with quote

icon_confused.gif Ok Terry icon_wink.gif

actually my doubt was to check what will happen when PERFORM 1000-PARA is executed where 1000-PARA doesn't have any EXIT, I think Robert Sample explained that clearly saying the control will return back after the PERFORM Statement once all the code with in 1000-PARA is executed,it doesn't goto 2000-PARA.
Back to top
View user's profile Send private message
sundar28

New User


Joined: 30 Jul 2005
Posts: 12
Location: Mysore

PostPosted: Thu Feb 26, 2009 12:19 pm    Post subject:
Reply with quote

The difference is the convention of having a name for the end of each para.

In structured programming, GOTO is forbidden. It is permitted to transfer the control to the end of current para alone. To achieve this, a name for the end of the para is needed.

When we reuse the portions of existing code into our new code we can achieve structured logic by constraining all GOTOs to their respective exit para. The code would still be structured and with little changes.

The above facts are my perceptions with my experience; please correct me if they are not precise.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts EXIT or RETURN cvnlynn CLIST & REXX 18 Wed Jul 19, 2017 2:50 am
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm
No new posts SORT - E15 and E35 using same user ex... Abhi Nature DFSORT/ICETOOL 12 Mon Oct 03, 2016 4:33 pm
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us