Debug Module | Double-Byte Character Set Support |
The segmentation module provides a capability to specify object program overlay requirements.
Segmentation provides a facility for specifying permanent and independent segments. Segmentation also allows the intermixing of sections with different segment-numbers and allows the fixed portion of the source program to contain segments that can be overlaid.
The Segmentation module is classed as an obsolete element in the ANSI'85 standard and is scheduled to be deleted from the next full revision of the ANSI Standard.
All dialects in this COBOL implementation fully support this syntax. The FLAGSTD directive can be used to detect all occurrences of this syntax.
Although it is a part of the standard COBOL definition, this module is explicity excluded from the X/Open COBOL language definitions and should not be used in a conforming X/Open COBOL source program.
COBOL segmentation is a facility that provides a means by which the user can communicate with your COBOL system to specify object program overlay requirements.
COBOL segmentation deals only with segmentation of procedures. As such, only the Procedure Division is considered in determining segmentation requirements for an object program.
Although it is not mandatory, the Procedure Division for a source program is often written as a consecutive group of sections, each of which is composed of a series of closely related operations that are designed to collectively perform a particular function. However, when segmentation is used, the entire Procedure Division must be in sections. In addition, each section must be classified as belonging either to the fixed portion or to one of the independent segments of the object program. Segmentation in no way affects the need for qualification of procedure-names to ensure uniqueness.
The fixed portion is defined as that part of the object program which is logically treated as if it were always in memory. This portion of the program is composed of fixed permanent segments, and fixed overlayable segments.
A fixed permanent segment is a segment in the fixed portion which cannot be overlaid by any other part of the program.
A fixed overlayable segment is a segment in the fixed portion which, although logically treated as if it were always in memory, can be overlaid by another segment to optimize memory utilization.
An independent segment is defined as part of the object program which can overlay, and can be overlaid by either a fixed overlayable segment or another independent segment. An independent segment is in its initial state whenever control is transferred (either implicitly or explicitly) to that segment for the first time during the execution of a program. On subsequent transfers of control to the segment, an independent segment is also in its initial state when:
On subsequent transfer of control to the segment, an independent segment is in its last-used state when:
or GOBACK
statement.
Sections which are to be segmented are classified, using a system of segment-numbers and the following criteria:
Sections which must be available for reference at all times, or which are referred to very frequently, are normally classified as belonging either to one of the overlayable fixed segments or to one of the permanent segments; sections which are used less frequently are normally classified as belonging to one of the independent segments, depending on logic requirements.
Generally, the more frequently a section is referred to, the lower its segment-number; the less frequently it is referred to, the higher its segment-number.
Sections which frequently communicate with one another should be given the same segment-numbers.
The logical sequence of the program is the same as the physical sequence except for specific transfers of control. Control can be transferred in a source program to any paragraph in a section; that is, it is not mandatory to transfer control to the beginning of a section.
Section classification is accomplished by means of a system of segment-numbers. The segment-number is included in the section header.
The SEGMENT-LIMIT clause appears in the OBJECT-COMPUTER paragraph and has the following format:
When segmentation is used, the following restrictions are placed on the ALTER, PERFORM, MERGE and SORT statements.
A GO TO statement in a section whose segment-number is greater than or equal to 50 must not be referred to by an ALTER statement in a section with a different segment-number.
All other uses of the ALTER statement are valid and performed even if the GO TO to which the ALTER refers is in a fixed overlayable segment.
A PERFORM statement that appears in a section that is not in an independent segment can have within its range, in addition to any declarative sections whose execution is caused within that range, only one of the following:
A PERFORM statement that appears in an independent segment can have within its range, in addition to any declarative sections whose execution is caused within that range, only one of the following:
If the MERGE statement appears in a section that is not in an independent segment, then any output procedure referenced by that MERGE statement must appear:
If a MERGE statement appears in an independent segment, then any output procedure referenced by that MERGE statement must be contained:
If a SORT statement appears in a section that is not an independent segment, then any input procedures or output procedures referenced by that SORT statement must appear:
If a SORT statement appears in an independent segment, then any input procedures or output procedures referenced by that SORT statement must be contained:
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Debug Module | Double-Byte Character Set Support |