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

Perform-Section


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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: 92

PostPosted: Thu Apr 24, 2008 4:42 pm
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
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: 275
Location: Bang,iflex

PostPosted: Thu Apr 24, 2008 5:29 pm
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
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
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

Moderator Emeritus


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

PostPosted: Thu Apr 24, 2008 8:19 pm
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: 92

PostPosted: Thu Apr 24, 2008 10:37 pm
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
Reply with quote

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

Moderator Emeritus


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

PostPosted: Thu Apr 24, 2008 11:43 pm
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: 2146
Location: At my coffee table

PostPosted: Fri Apr 25, 2008 1:30 am
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

Superior Member


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

PostPosted: Fri Apr 25, 2008 2:34 am
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

Superior Member


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

PostPosted: Fri Apr 25, 2008 2:39 am
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

Superior Member


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

PostPosted: Fri Apr 25, 2008 2:48 am
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

Superior Member


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

PostPosted: Fri Apr 25, 2008 2:51 am
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: 2146
Location: At my coffee table

PostPosted: Fri Apr 25, 2008 3:08 am
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

Moderator Emeritus


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

PostPosted: Fri Apr 25, 2008 4:09 am
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
CICS Guy

Senior Member


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

PostPosted: Fri Apr 25, 2008 4:46 am
Reply with quote

dick scherrer wrote:
And if the "lesson" was actually about SECTIONs, the point was entirely missed. . .
Missed by me too, those were paragraph names......
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Fri Apr 25, 2008 5:05 am
Reply with quote

CICS Guy wrote:
There are several who confuse which ID they are signed on as....grin......
yeah I'm still dealing with William & CICS Guy mystery... icon_razz.gif

Quote:
And if the "lesson" was actually about SECTIONs, the point was entirely missed. . .
We should have a seperate Forum for 'most confusing posts'..or a award on 'most confusing posts of the day'.. icon_biggrin.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Fri Apr 25, 2008 5:18 am
Reply with quote

Anuj D. wrote:
Quote:
And if the "lesson" was actually about SECTIONs, the point was entirely missed. . .
We should have a seperate Forum for 'most confusing posts'..or a award on 'most confusing posts of the day'.. icon_biggrin.gif
A good suggestion, it is more direct than the Off Topic hole..... And heck, might be more fun.... icon_lol.gif
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 92

PostPosted: Fri Apr 25, 2008 11:01 am
Reply with quote

Hi D.Sch,

The new code (with an additional display statement) that I tried is:

PROCEDURE DIVISION.
0000-MAINLINE.

PERFORM SECTIONA.

DISPLAY 'AFTER PERFORM'.

SECTIONA.
DISPLAY 'INSIDE SECTIONA'.

DISPLAY 'GOING BACK'.
GOBACK.

0000-EXIT.
EXIT.

My new sysout is:

INSIDE SECTIONA
GOING BACK
Back to top
View user's profile Send private message
mohitsaini
Warnings : 1

New User


Joined: 15 May 2006
Posts: 92

PostPosted: Fri Apr 25, 2008 11:07 am
Reply with quote

Hey guys ... let me clear this up .. although the post was started by "RDR" .... but when I tried solving/running his problem/code .... I got some doubts too .... So I also participated in the discussion .... that's all ....

Plz let me know if there is any kind of format/protocol you guys follow while replying to queries.

Sorry for the confusion that was created bcoz of me.

- Mohit
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Use of Perform Thru Exit COBOL Programming 6
No new posts FD Section to Create FB or Vb File Dy... COBOL Programming 1
No new posts Sections: need one appearance of cer... DFSORT/ICETOOL 4
Search our Forums:

Back to Top