Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Want to know the diff between PERFORM and PERFORM-THRU

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vivek_mvs1

New User


Joined: 25 Apr 2006
Posts: 12

PostPosted: Sat Feb 17, 2007 11:22 am    Post subject: Want to know the diff between PERFORM and PERFORM-THRU
Reply with quote

Hi,

i would like to know about PERFORM statement in COBOL.

I want to know the diff between PERFORM and PERFORM-THRU,and how the controls are passed in both.

For eg:
PERFORM L-1
-----------
-----------
L-1.
--------
--------
EXIT.
L-2.
-------
-------
Will the control be passed back the to statements after PERFORM,before L-2 is executed?
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sat Feb 17, 2007 3:30 pm    Post subject:
Reply with quote

Yes, as long as L-1 logic does not branch anywhere else.
Back to top
View user's profile Send private message
krishna_sureka

New User


Joined: 05 Sep 2006
Posts: 7
Location: Pune

PostPosted: Wed Feb 21, 2007 3:50 pm    Post subject:
Reply with quote

Different forms of Perform:

1. Simple PERFORM
PERFORM Paragraph-Name.
(In this case the execution returns to the statement after the perform statemetnt once the para is executed.)

2. In-line PERFORM
PERFORM
logic
END-PERFORM

3. PERFORM . . . THRU

PERFORM C1000-BEGIN-CALC-PARA THRU C5000-END-CALC-PARA
(In this case the execution starts with the first statement in C1000-BEGIN-CALC-PARA and ends with the last statement of C5000-END-CALC-PARA)

4. PERFORM . . . UNTIL
PERFORM Paragraph-Name-1 UNTIL condition

5. PERFORM . . . TIMES
PERFORM Paragraph-Name-1 integer TIMES.

6. PERFORM . . . VARYING

PERFORM Paragraph-Name-1 [ { THRU, THROUGH }Paragraph-Name-2 ] VARYING identifier-1 FROM
{identifier-2, integer-1} BY { identifier-3, integer-2 }
UNTIL condition.

Eg.
PERFORM 500-WRITE-PARA VARYING I FROM 1 BY 1 UNTIL I > 5.

Let me know if more explanation required on any of the above way of using PERFORM.
Back to top
View user's profile Send private message
DeepaBala

New User


Joined: 20 Feb 2007
Posts: 13
Location: Trivandrum

PostPosted: Thu Feb 22, 2007 10:45 am    Post subject:
Reply with quote

Hi Friends,

I have one doubt. plz clear that.

I want to Know What is the Difference b/w Perform with after and prform with before...
plz give some examples for easy understanding
Back to top
View user's profile Send private message
krishna_sureka

New User


Joined: 05 Sep 2006
Posts: 7
Location: Pune

PostPosted: Thu Feb 22, 2007 12:17 pm    Post subject: Re: Want to know the diff between PERFORM and PERFORM-THRU
Reply with quote

If the TEST BEFORE phrase is specified, the condition is tested before any statements are executed and if the TEST AFTER phrase is specified, the statements to be performed are executed at least once before the condition is tested

Format: PERFORM procedure-name-1 [{THRU, THROUGH} procedure-name-2] UNTIL condition
[WITH TEST {AFTER, BEFORE}].

Examples:
Assume that EOF is already set to "Y"

1. TEST AFTER:

PERFORM READ-PARA UNTIL EOF = ?Y? WITH TEST AFTER.

Now even though the EOF is already "Y", READ-PARA will be executed once and then condition will be checked later.


2. TEST BEFORE

PERFORM READ-PARA UNTIL EOF = ?Y? WITH TEST BEFORE.

In this case the condition is checked before any statement is executed so as EOF is already "Y", READ-PARA will not be executed even one time also.
Back to top
View user's profile Send private message
DeepaBala

New User


Joined: 20 Feb 2007
Posts: 13
Location: Trivandrum

PostPosted: Thu Feb 22, 2007 2:17 pm    Post subject:
Reply with quote

Thanks for the information
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Thu Feb 22, 2007 4:09 pm    Post subject:
Reply with quote

DeepaBala wrote:
Hi Friends,

I have one doubt. plz clear that.

I want to Know What is the Difference b/w Perform with after and prform with before...
plz give some examples for easy understanding


ANSWER;
MOSTLY THIS TERM IS COMES ACROSS WHEN YOU USE MULTIDIMENTION TABLE
I GIVE YOU EXAMPLE
SUPPOSE IN ONE SHCOOL/CLASS THERE ARE STUDENTS AND E THEY HAVE 5 SUBJECTS EACH SO I WANT TO MAKE TABLE FOR THIS THEN
SO I SEE YOU STRUCTURE
STUDENT 1. HARISH HIS 5 SUBJECTS 1.VVV
2.YYY
3.TTT
4.YYY
.HHH
2.SACHIN 1.VVV
2.YYY
3.TTT
4.YYY
5.HHH
SO I WANT TO MAKE TABLE FOR THIS
THEN PROGRAME IS
ID DIVISION.
PROGRAM-ID.
WORKING-STORAGE SECTION.
O1 CLASS
02 STUDEN-NAME PIC X(10) OCCURES 10 TIMES INDEXED BY I.
O2 SUBJECTS PIC X(3) OCCURS 5 TIMES INDEXED BY J.
PROCEDURE DIVISION.
ACCEPT I.
PERFORM WITH VARYING BEFORE I FROM 1 BY 1 UNTIL I >10
ACCEPT J
PERFORM WITH TEST AFTER J FROM 1 BY 1 UNTIL J>5
DISPLAY I , J.
STOP RUN.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Feb 22, 2007 4:47 pm    Post subject:
Reply with quote

sachin,

Try at least to use the correct syntax in your examples.... icon_rolleyes.gif
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 How to perform Digest Access Authenti... vasanthz All Other Mainframe Topics 0 Tue Mar 15, 2016 4:47 pm
No new posts Compare PD Values with same storage &... Shrinika Rajendran JCL & VSAM 5 Wed Nov 05, 2014 3:17 pm
No new posts merge records from 2 ps files with di... kishpra DFSORT/ICETOOL 6 Wed Mar 19, 2014 1:00 pm
No new posts Need help on SORT to write each input... rahul sijoriya JCL & VSAM 4 Mon Dec 02, 2013 9:09 pm
No new posts Infinite loop Issue in perform Until shankarm COBOL Programming 18 Wed Jul 31, 2013 7:53 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us