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
 

 

What if SECTION keyword not used

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

New User


Joined: 03 Jun 2008
Posts: 30
Location: India

PostPosted: Fri Aug 14, 2009 5:02 pm    Post subject: What if SECTION keyword not used
Reply with quote

While defining a new paragraph in cobol, what are the consequences if SECTION keyword is not used in paragraph name ?

Thanks
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Fri Aug 14, 2009 5:20 pm    Post subject:
Reply with quote

A SECTION can contain more than one paragraph. Doing a PERFORM of a SECTION means multiple paragraphs may be executed. Having SECTION names in the PROCEDURE DIVISION is not required.

Way back when a mainframe could have as little as 64K of memory (when I was in school, we ran a 360-30 with 3 partitions with 32K, 20K, and 12K), the SECTION names were numbered and these SECTION numbers were used to define the overlay structure of the program. This allowed swapping of pieces of the program not currently in use out to auxiliary storage so larger programs than would physically fit in memory could be executed. This practice has been obsolete for quite some time since mainframes have more memory these days.
Back to top
View user's profile Send private message
rulerofera

New User


Joined: 03 Jun 2008
Posts: 30
Location: India

PostPosted: Fri Aug 14, 2009 6:25 pm    Post subject:
Reply with quote

Thank You, Robert. That is certainly very well explained.

Just one more thing, though you have already answered, but I was thinking in terms of code fall through. What I mean by this is, if I have a call as PERFORM PARA1 and then PARA1 is followed by PARA2 without any EXIT lines in between and no SECTION keywords, will the control at end of PARA1 fall through the code in PARA2, because EXIT line is not there (in sense usually we have call as PERFORM 100-P1 thru 100-EXIT).

And will the functionality be same in both COBOL and COBOLII compiled programs.

Thanks.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 14, 2009 6:31 pm    Post subject:
Reply with quote

you will find that an exit statement does not do anything.

you perform a para or a sect, execution stops at the next para or section name. If the performing a para, the paragraph with the exit statement is just another paragraph so rookies can 'GO TO' instead of modular coding to avoid 'GO TOs'.
Back to top
View user's profile Send private message
rulerofera

New User


Joined: 03 Jun 2008
Posts: 30
Location: India

PostPosted: Fri Aug 14, 2009 6:47 pm    Post subject:
Reply with quote

Right, Dick.

I tried all the possibilities which I raised earlier. Findings are - code do not fall through, compiled with both COBOL and COBOII program types.
What I did is, I included a para PAR2 immediatley after PARA1 and call only to PARA1. COBOLII compiled with RC = 4 and eleminated uncalled paragraphs. While, COBOL compiled with RC =0 but the control do not fall through PARA2, it executed only PARA1 and finished.

So which means, the only reason to have SECTION keyword is to denote the start of some paragraph; an identifier kind of thing - original purpose lost in history.

Thank You!! - Robert and Dick.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 14, 2009 7:07 pm    Post subject:
Reply with quote

Quote:
the only reason to have SECTION keyword is to denote the start of some paragraph


rulerofera,

you can perform a section - which will execute all paragraphs in that section. (sort of like perform para thru para.)
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1239
Location: Richfield, MN, USA

PostPosted: Fri Aug 14, 2009 7:16 pm    Post subject:
Reply with quote

Some shops insist on SECTIONS only, some PARAGRAPHS only. It's unwise to have both in the same program.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Aug 14, 2009 8:48 pm    Post subject:
Reply with quote

Quote:
It's unwise to have both in the same program

as i indicated in my earlier post, without the para names in the sections,
they can't write their GO TO's.
Back to top
View user's profile Send private message
rulerofera

New User


Joined: 03 Jun 2008
Posts: 30
Location: India

PostPosted: Fri Aug 14, 2009 9:35 pm    Post subject:
Reply with quote

So it is like, if one uses Go To to call a PARA and if the following para do not have SECTION keyword, then I think the control at end of PARA1 is bound to fall through PARA2
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Fri Aug 14, 2009 10:10 pm    Post subject:
Reply with quote

You don't call a paragraph or a section. Section is a COBOL reserved word. When you perform a section you perform from the start of the SECTION upto and including the last statement of the last paragraph before the next section then control returns to the statement after the perform. If you perform a paragraph control returns to the next statement after the perform at the end of the paragraph you are performing.

GO TO and PERFORM are completely different.

Just consider a SECTION as a collection of paragraphs.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Mon Aug 17, 2009 1:17 pm    Post subject:
Reply with quote

Hi rulerofera,

You could probably have a look into this topic which was discussed some time back.
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Illegal use of keyword fetch. Token w... HABBIE DB2 2 Fri Aug 28, 2015 5:20 pm
No new posts IFTHEN & BUILD - If keyword match... Roach_MF DFSORT/ICETOOL 4 Wed Mar 18, 2015 1:21 am
No new posts COBOL 5.1 and the UNBOUNDED Keyword Bill O'Boyle COBOL Programming 2 Tue Apr 29, 2014 7:31 pm
No new posts Getting DCA006E - Smart/RRSAF found u... Rohit Umarjikar COBOL Programming 6 Fri Mar 21, 2014 10:45 am


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