Segmentation allows the user to segment the Procedure Division of a program, and to specify overlays among the segments.Thus, less runtime memory is required to execute the program.There is no provision for segmenting the data regions of a program.
When segmentation is used, the Procedure Division must be written as a series of 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 as determined by the assignment of segment-numbers.All paragraphs that contain the same segment-number in their section headers are considered at object time to be one segment. Since segment-numbers can range from 0 through 127, it is possible to subdivide the object program into a maximum of 128 segments.Segmentation has no effect on the need to qualify procedure-names to ensure uniqueness.
The fixed portion of the object program is logically treated as if it were always in memory.All sections whose segment-number is less than 50 belong to the fixed portion. The fixed portion of the program is made up of two types of segments:fixed permanent segments and fixed overlayable segments.
A fixed permanent segment is a segment in the fixed portion that cannot be overlaid by any other part of the program. A fixed overlayable segment is a segment in the fixed portion that, although logically treated as if it were always in memory, can be overlaid by another segment so as to reduce memory utilization.Such a segment, if called for by the program, is always made available in its last-used state. Variation of the number of fixed permanent segments in the fixed portion can be accomplished by using the SEGMENT- LIMIT clause.
An independent segment is defined as part of the object program that can overlay, and can be overlaid by, a fixed overlayable segment or another independent segment.An independent segment has a segment-number of 50 through 127.
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 the program.
On subsequent transfers of control to the segment, an independent segment is also in its initial state when:
On subsequent transfers of control to the segment, an independent segment is in its last-used state when:
Sections that are to be segmented are classified using a system of segment-numbers and the following criteria:
The logical sequence of the program is the same as the physical sequence except for specific transfers of control.Control may 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.
Restrictions on Program Flow
When segmentation is used, the following restrictions are placed on the ALTER, PERFORM, MERGE and SORT statements.
ALTER Statement Restrictions
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.
PERFORM Statement Restrictions
A PERFORM statement in the fixed portion 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 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:
MERGE Statement Restrictions
If a MERGE statement appears in the fixed portion, any output procedure referenced by that MERGE statement must be entirely within the fixed portion, or entirely within a single independent segment.
If a MERGE statement appears in an independent segment, any output procedure referenced by that MERGE statement must be entirely within the fixed portion, or entirely within the same independent segment as that MERGE statement.
SORT Statement Restrictions
If a SORT statement appears in the fixed portion, any input or output procedures referenced by that SORT statement must be entirely within the fixed portion, or entirely within a single independent segment.
If a SORT statement appears in an independent segment, any input or output procedures referenced by that SORT statement must be entirely within the fixed portion, or entirely within the same independent segment as that SORT statement.
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.