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-Section
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
rdr

New User


Joined: 26 May 2006
Posts: 35
Location: india

PostPosted: Thu Apr 24, 2008 2:25 pm    Post subject: Perform-Section
Reply with quote

Hi All,

Please let me know if SECTIONA is the only section in the program,
will controle come back to DISPLAY statement after performing the
SECTIONA???


Ex:

Procedure Division.

Perform SectionA.

Display 'After Perform'.

SECTIONA.

---------
---------
---------
---------
END OF SECTIONA.

STOP RUN.
Back to top
View user's profile Send private message

the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Thu Apr 24, 2008 2:41 pm    Post subject:
Reply with quote

yes, obviously.
Back to top
View user's profile Send private message
Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Thu Apr 24, 2008 3:01 pm    Post subject: Re: Perform-Section
Reply with quote

rdr wrote:
Hi All,

Please let me know if SECTIONA is the only section in the program,
will controle come back to DISPLAY statement after performing the
SECTIONA???


Ex:

Procedure Division.

Perform SectionA.

Display 'After Perform'.

SECTIONA.

---------
---------
---------
---------
END OF SECTIONA.

STOP RUN.


Why don't you try running it?
Code:

Procedure Division.

Perform SectionA.

Display 'After Perform'.

SECTIONA.
     Display 'inside SECTIONA'.


Please let us know the result after you execute it. icon_smile.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 24, 2008 3:44 pm    Post subject:
Reply with quote

after the return to the display command, then you will drop thru section a till you hit the stop run (which you should make - goback).
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 87

PostPosted: Thu Apr 24, 2008 4:42 pm    Post subject:
Reply with quote

for me the output coming is

INSIDE SECTIONA

I didn't expect that ... I thought that the output would be:

INSIDE SECTIONA
AFTER PERFORM.

why is it behaving like this??
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Apr 24, 2008 5:10 pm    Post subject:
Reply with quote

Is there a stop run or a goback in sectiona?
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Thu Apr 24, 2008 5:29 pm    Post subject:
Reply with quote

Hello,


If STOP RUN or GO BACK, what is the difference???
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 24, 2008 5:41 pm    Post subject:
Reply with quote

STOP RUN stops the run unit.

GOBACK returns to caller, whether program, mvs or whatever.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Apr 24, 2008 5:44 pm    Post subject:
Reply with quote

since you did not post your code (where is the SECTION. statement?) sorta hard to determine what you have and why. Looks like you are performing paragraphs and do you have a go to anywhere?

no more questions, post the code.......................
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Apr 24, 2008 8:19 pm    Post subject:
Reply with quote

Hello,

Quote:
Please let me know if SECTIONA is the only section in the program,
There are no sections in the posted code.

Quote:
for me the output coming is

INSIDE SECTIONA
Not from the posted code. . .

Is there actually a question at all? As DBZ says "post the code................."
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 87

PostPosted: Thu Apr 24, 2008 10:37 pm    Post subject:
Reply with quote

Procedure Division.

Perform SectionA.

Display 'After Perform'.

SECTIONA.
Display 'inside SECTIONA'.


When I ran the above code I got:

INSIDE SECTIONA

I didn't expect that ... I thought that the output would be:

INSIDE SECTIONA
AFTER PERFORM.

why is it behaving like this??
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Apr 24, 2008 11:25 pm    Post subject:
Reply with quote

What is inside SECTIONA?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Apr 24, 2008 11:43 pm    Post subject:
Reply with quote

Hello,

Quote:
When I ran the above code I got:
No, you did not. . . You ran some other or additonal code.

Quote:
why is it behaving like this??
Until you post the code, no one can give you a useful answer.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Apr 25, 2008 1:30 am    Post subject:
Reply with quote

Doesn't COBOL generate an implicit GOBACK at the end of the a program?
Won't "END OF SECTIONA" generate a syntax error, and possibly just be ignored?
What kind of paragraph name is SECTIONA? Somewhat confusing, isn't it?

Is it time for this to fall into the OT hole?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Fri Apr 25, 2008 2:34 am    Post subject:
Reply with quote

Well,

Your first post
Code:
Procedure Division.

Perform SectionA.

Display 'After Perform'.

SECTIONA.

---------
---------
---------
---------
END OF SECTIONA.

STOP RUN.


Your expected output is
Quote:
INSIDE SECTIONA
AFTER PERFORM.
I assume when you say "output", you actaully taking about DISPLAY statements of your program; if so
Quote:
INSIDE SECTIONA
was never DISPLAYed in your above code, the output you got
Quote:
INSIDE SECTIONA
is confusing.

Per your second code, the expected output make a little sense but are you sure there is no other PERFORM SECTIONA in your program. And if only one PERFORM then where do you 'instruct' the program to 'stop', as asked earlier where do you code, GO BACK or STOP RUN.

BTW, SECTIONA is not a good choice for para-name; SECTIONs have different meaning in COBOL.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Fri Apr 25, 2008 2:39 am    Post subject:
Reply with quote

CICS Guy wrote:
Doesn't COBOL generate an implicit GOBACK at the end of the a program?
No I think it doesn't happen. Ran a program without GO BACK (or STOP RUN), program was abended with ABEND=S000 U4038 REASON=00000001
with the following message in SYSOUT
Quote:
The flow of control in program TESTPGM proceeded beyond the last line of the program.

While the same program executes well with GO BACK.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Fri Apr 25, 2008 2:48 am    Post subject:
Reply with quote

Once again I'm in..

Tried the below codes:

Code:
PROCEDURE DIVISION.               
          PERFORM 0000-PARA.     
          DISPLAY"AFTER PERFORM".
                                     
0000-PARA.                       
     DISPLAY"INSIDE PARA".
     GOBACK.                       


SYSOUT:
Code:
INSIDE PARA


And the other code is:
Code:
PROCEDURE DIVISION.               
          PERFORM 0000-PARA.     
          DISPLAY"AFTER PERFORM".
    GOBACK.                       
                                 
0000-PARA.                       
     DISPLAY"INSIDE PARA".       


SYSOUT:
Code:
INSIDE PARA 
AFTER PERFORM


Check the positions of GO BACK.

Hope this helps.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Fri Apr 25, 2008 2:51 am    Post subject:
Reply with quote

One moment..something wrong is here..thread is started by "rdr" & followed up by "mohitsaini"....who I'm answering to... icon_confused.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Apr 25, 2008 3:08 am    Post subject:
Reply with quote

Anuj D. wrote:
One moment..something wrong is here..thread is started by "rdr" & followed up by "mohitsaini"....who I'm answering to... icon_confused.gif
There are several who confuse which ID they are signed on as....grin......
Or it just coud be that "mohitsaini" managed to duplicate "rdr"s actual (unposted) code......
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 25, 2008 4:09 am    Post subject: Reply to: Perform-Section
Reply with quote

Possibly the same homework assignment. . .?

And if the "lesson" was actually about SECTIONs, the point was entirely missed. . .

d
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
Goto page 1, 2  Next
Page 1 of 2

 

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 Infinite loop Issue in perform Until shankarm COBOL Programming 18 Wed Jul 31, 2013 7:53 pm
No new posts Linkage Section for Three programs Mr.Niceguy COBOL Programming 13 Sat Jun 01, 2013 7:21 pm
No new posts Sort - Header on Page Break and Secti... srinathds83 SYNCSORT 7 Mon May 13, 2013 11:31 am
No new posts Perform airthmetic operations in JCL jithumohan JCL & VSAM 4 Fri Mar 15, 2013 12:06 am


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