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

PERFORM PARA vs PERFORM PARA THRU EXIT-PARA


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Feb 25, 2009 4:50 pm
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
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
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
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: 11
Location: Mysore

PostPosted: Thu Feb 26, 2009 12:19 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Use of Perform Thru Exit COBOL Programming 6
No new posts user exit in IBM Infosphere Optim DB2 8
This topic is locked: you cannot edit posts or make replies. Programa para Realiza Operaciones sob... JCL & VSAM 3
No new posts ACS exit routine JCL & VSAM 0
No new posts Research regarding csqcapx exit CICS 0
Search our Forums:

Back to Top