Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

PERFORM statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: PERFORM statement
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: 7931
Location: Bellevue, IA

PostPosted: Mon Dec 06, 2010 6:46 am    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Mon Dec 06, 2010 4:07 pm    Post subject:
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: 7931
Location: Bellevue, IA

PostPosted: Mon Dec 06, 2010 4:55 pm    Post subject:
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

Active Member


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

PostPosted: Mon Dec 06, 2010 6:19 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue Dec 07, 2010 5:23 pm    Post subject: Reply to: PERFORM statement
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

Senior Member


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

PostPosted: Tue Dec 07, 2010 6:40 pm    Post subject:
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    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 -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am
No new posts Inspect statement spoorni COBOL Programming 5 Mon Jun 06, 2016 9:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us