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

Question on PERFORM n times


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

New User


Joined: 18 Apr 2007
Posts: 1
Location: India

PostPosted: Tue Feb 19, 2008 3:56 pm
Reply with quote

If I have a code like

MOVE 01 TO WS-COUNT
PERFORM PARA-1 WS-COUNT TIMES



PARA-1.
DISPLAY ' HI '
ADD +1 TO WS-COUNT
IF WS-COUNT > 10
GO BACK
END-IF.



Howmany times 'HI' will get displyed?
Whether 1 time or 10 times
Since the value of WS-COUNT is getting increased by 1 each time.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Feb 19, 2008 4:52 pm
Reply with quote

test it yourself...................
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Tue Feb 19, 2008 4:55 pm
Reply with quote

Once
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue Feb 19, 2008 5:58 pm
Reply with quote

yes, once OF COURSE.

Quote:

MOVE 01 TO WS-COUNT
PERFORM PARA-1 1 TIMES
Back to top
View user's profile Send private message
shitij

New User


Joined: 09 Sep 2005
Posts: 31
Location: Delhi

PostPosted: Tue Feb 19, 2008 6:06 pm
Reply with quote

U have coded:

Code:
MOVE 01 TO WS-COUNT
PERFORM PARA-1 WS-COUNT TIMES



That means:

Code:
MOVE 01 TO WS-COUNT i.e. (WS-COUNT=1)


Now u tell the code to:

Code:
PERFORM PARA-1 WS-COUNT TIMES

i.e. PERFORM PARA-1 01 TIMES


Therefore it will perform only once.


Regards,
Shitij
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 Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts Updating a 1 byte thats in occurs mul... DFSORT/ICETOOL 6
Search our Forums:

Back to Top