View previous topic :: View next topic |
Author |
Message |
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Wed Aug 12, 2009 5:47 pm Post subject: Sections to Paragraphs |
|
|
Members,
I have an old COBOL program written with SECTIONS. I have made changes to the program to have paragraphs instead of SECTIONS for my ease of use and clear understanding. The way program is working with SECTIONS is somewhat different from paragraphs and this could be my mistake while conversion. Are there any ways to handle this , I mean can i get some useful tips to clarify myself while converting SECTIONS to Paragraphs. |
|
Back to top |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Wed Aug 12, 2009 5:58 pm Post subject: |
|
|
Since the start of a SECTION is the end of the previous one, you will have a problem if there were any other paragraphs within a SECTION. In other words, it won't be a one-for-one type of conversion. When you PERFORM a section, every paragraph within that section gets performed and the section ends either with the start of the next section or end of source code. Was there a requirement to convert to paragraphs? Some shops say "sections only", some say "paragraphs only". It's not a good idea to have both in the same program. Read about sections in the Language Reference Manual. _________________ ....Terry |
|
Back to top |
|
|
jctgf Beginner
Joined: 05 Nov 2006 Posts: 89 Topics: 36
|
Posted: Wed Sep 30, 2009 10:00 am Post subject: |
|
|
I agree: it |
|
Back to top |
|
|
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Wed Sep 30, 2009 1:02 pm Post subject: |
|
|
A bit of history: 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, 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. /History off/
You perform a para or a section and 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 sometimes they can use 'GO TO'. But catch is, without the para names in the sections, they can't write their GO TO's.
And as others have said it's unwise to have both in the same program. _________________ Regards,
Anuj |
|
Back to top |
|
|
|
|