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

PERFORM statement


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

New User


Joined: 24 Jun 2006
Posts: 50

PostPosted: Mon Dec 06, 2010 6:41 am
Reply with quote

Hi,

Can I execute a section by using a perform statement in decreasing order
e.g.

01 I1 pic s99.

some value is calculated in the program for I1........

Perfrom XYZ varying I1 from I1 by -1 until I1 < 1

Kindly let me know if the above syntax will work...

Rahul
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: Mon Dec 06, 2010 6:46 am
Reply with quote

There is a link to manuals at the top of this page. If you click on it, find the COBOL Language Reference manual, and read sections 6.2.27.5 and 6.2.27.10 on PERFORM VARYING, all your questions will be answered -- as long as you pay sufficient attention to what is said.
Back to top
View user's profile Send private message
Rahul_kumar
Warnings : 2

New User


Joined: 24 Jun 2006
Posts: 50

PostPosted: Mon Dec 06, 2010 2:59 pm
Reply with quote

Checked the manual ;it says :

identifier Must be a numeric elementary item,so I guess -1 will work but I am a bit confused.

Perfrom XYZ varying I1 from I1 by -1 until I1 < 1
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 Dec 06, 2010 4:07 pm
Reply with quote

Why not you just execute a test?
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: Mon Dec 06, 2010 4:55 pm
Reply with quote

Did you notice in section 6.2.27.5 that using variables requires different variables for the VARYING and FROM phrases? identifier-2 and identifier-3 don't refer to the same variable.

Furthermore, 6.2.27.10 specifically states that non-zero numeric variables or literals are required for the BY variable, so -1 will obviously work.

As I said, pay attention to the details.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Dec 06, 2010 6:19 pm
Reply with quote

Why not just test it already and actually learn how to learn? Experiment.
Back to top
View user's profile Send private message
Rahul_kumar
Warnings : 2

New User


Joined: 24 Jun 2006
Posts: 50

PostPosted: Tue Dec 07, 2010 5:08 pm
Reply with quote

The table is still not in place that's why ca'nt check icon_sad.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Dec 07, 2010 5:23 pm
Reply with quote

what a lame excuse

no need of any table to write a small program to check the syntax of ithe PERFORM statement

You could simply print the <index> inside the loop!
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Tue Dec 07, 2010 6:40 pm
Reply with quote

Well, just a suggestion - write the code, compile it , at least you'd know if there is any syntax-error with the code ...you're thinking can or can not work.
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 JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts process statement for SUPREC, CMPCOLM... TSO/ISPF 4
No new posts SYNCSORT/ICETOOL JOINKEYS SORT Statem... DFSORT/ICETOOL 13
Search our Forums:

Back to Top