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

Question on Perform statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lewafa

New User


Joined: 13 Feb 2008
Posts: 3
Location: India

PostPosted: Wed Feb 17, 2010 11:15 am
Reply with quote

Hi,

I have a quick question on the below code with how the PERFORM statement works..

Code:
.
.
.
        PERFORM PARA-NAME-1 THRU PARA-NAME-1.
.
.
.
PARA-NAME-1.
        .
        .
        .
EX-PARA-NAME-1.
   EXIT.




Ideally the above PERFORM statement should have been written as
PERFORM PARA-NAME-1 THRU EX-PARA-NAME-1. But there was a typo mistake and the actual code was PERFORM PARA-NAME-1 THRU PARA-NAME-1. When the above code is executed will the statements inside the PARA-NAME-1 would be executed or not?
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Wed Feb 17, 2010 11:27 am
Reply with quote

Quote:
When the above code is executed will the statements inside the PARA-NAME-1 would be executed or not?

They will be executed (once).
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Feb 17, 2010 11:35 am
Reply with quote

Hello,

Quote:
But there was a typo mistake and the actual code was PERFORM PARA-NAME-1 THRU PARA-NAME-1.
If there is an instruction in PARA-NAME-1 that issues a GO TO EX-PARA-NAME-1, the result will be unpredictable as the execution can "fall thru" and cause a wide variety of surprises. . .
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Wed Feb 17, 2010 2:10 pm
Reply with quote

Why not run a quick test for what you've asked?
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 Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
Search our Forums:

Back to Top