HP 3000 Manuals

General Description of Segmentation [ COBOL/HP-UX Language Reference for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Language Reference for the Series 700 and 800

General Description of Segmentation 

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.

Organization 

Program Segments.   

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.

Fixed Portion.   

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.

Independent Segments.   

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:

   1.  Control 
       is transferred to that segment as a result of the implicit
       transfer of control between consecutive statements from a segment
       with a different segment-number.

   2.  Control is transferred to that segment as the result of the
       implicit transfer of control between a SORT or MERGE statement, in
       a segment with a different segment-number, and an associated input
       or output procedure in that independent segment.

   3.  Control is transferred explicitly to that segment from a segment
       with a different segment-number (with the exception noted in
       paragraph 2.  below).

On subsequent transfer of control to the segment, an independent segment
is in its last-used state when:

   1.  Control is transferred implicitly to that segment from a segment
       with a different segment-number (except as noted in paragraph 1.).

   2.  Control is transferred explicitly to that segment as the result of
       the execution of an EXIT PROGRAM or GOBACK  statement.  (OSVS)
       (VSC2) (MF)

Segmentation Classification 

Sections which are to be segmented are classified, using a system of
segment-numbers and the following criteria:

   1.  Logic Requirements.

       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.

   2.  Frequency of Use.

       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.

   3.  Relationship to Other Sections.

       Sections which frequently communicate with one another should be
       given the same segment-numbers.

Segmentation Control 

The logical sequence of the program is the same as the physical sequence
except for specific transfers of control.  Control can be transferred
within a source program to any paragraph in a section; that is, it is not
mandatory to transfer control to the beginning of a section.



MPE/iX 5.0 Documentation