View previous topic :: View next topic
|
Author |
Message |
rdr
New User
Joined: 26 May 2006 Posts: 35 Location: india
|
|
|
|
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 |
|
|
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 165 Location: Bangalore
|
|
|
|
yes, obviously. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
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. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Is there a stop run or a goback in sectiona? |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hello,
If STOP RUN or GO BACK, what is the difference??? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
STOP RUN stops the run unit.
GOBACK returns to caller, whether program, mvs or whatever. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
What is inside SECTIONA? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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
was never DISPLAYed in your above code, the output you got
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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:
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
One moment..something wrong is here..thread is started by "rdr" & followed up by "mohitsaini"....who I'm answering to... |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Anuj D. wrote: |
One moment..something wrong is here..thread is started by "rdr" & followed up by "mohitsaini"....who I'm answering to... |
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Possibly the same homework assignment. . .?
And if the "lesson" was actually about SECTIONs, the point was entirely missed. . .
d |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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...
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'.. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
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'.. |
A good suggestion, it is more direct than the Off Topic hole..... And heck, might be more fun.... |
|
Back to top |
|
|
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
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 |
|
|
mohitsaini Warnings : 1 New User
Joined: 15 May 2006 Posts: 92
|
|
|
|
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 |
|
|
|