View previous topic :: View next topic |
Author |
Message |
Torie03 Beginner
Joined: 02 Dec 2003 Posts: 1 Topics: 1
|
Posted: Tue Dec 02, 2003 3:40 pm Post subject: PERFORM statements in COBOL |
|
|
Hi everyone,
I'm a college student and i was wondering if anyone could help me out? What is better a Procedural PERFORM or an IN-LINE PERFORM statement?And what PEFRORM statement is the best one: the Perform....times, the perform...until, or the perform....varying? ANd why? I'm just confused b/c my text book doesnt explain it at all!! And I can't find any relevant websites! Thank for any and all help! It's must appreciated!  |
|
Back to top |
|
 |
RobertL Beginner

Joined: 18 Nov 2003 Posts: 22 Topics: 0 Location: Lisbon, Portugal
|
Posted: Tue Dec 02, 2003 6:12 pm Post subject: |
|
|
Hello Torie,
There isn't a better or worse PERFORM statement. They are each used for different types of situations.
In-line PERFORMs are for when you need to execute one or two (or zero) lines of code multiple times when it doesn't make sense to create a new paragraph (it also makes the code more readable in these cases).
PERFORM...TIMES is for when a paragraph or block of code needs to be executed a fixed number of times.
PERFORM...UNTIL is for when a paragraph or block of code needs to be executed until a particular condition is met.
the VARYING clause is used with PERFORM to increment (or decrement) an index each time the loop is executed.
Hope this helps.
Regards,
Robert |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Dec 03, 2003 6:52 am Post subject: |
|
|
Torie03,
welcome to mvsforums.As robert stated, each of the perform statement can be used based on the situation.As you are a student, I would advise you not to spend more time trying to determine which is more efficient as these instructions might save you a nano second in the long run.
With the latest and greatest cobol you don't have to worry about the efficiency of various cobol verbs.
check this topic which discusses COBOL Performance Tuning
http://www.mvsforums.com/helpboards/viewtopic.php?t=1485
Hope this helps...
cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|