[an error occurred while processing this directive]
HP OpenVMS Systems Documentation |
HP COBOL
|
Previous | Contents | Index |
Appendix C lists all the possible file status values that can appear
in the FILE STATUS data item, along with the I-O status condition
corresponding to each value.
6.6.9 AT END Phrase
The AT END phrase specifies the action your program takes when an at end condition occurs (when Status Key 1 contains 1).
The NOT AT END phrase specifies the action your program takes if an at end (or any other error condition) does not occur.
The format is as follows:
stment is one or more imperative statements.
When a program detects the end of a file, the condition is called the at end condition. The at end condition might occur as a result of ACCEPT, READ, RETURN, or SEARCH statement execution. (For additional information, see the previously mentioned statements.)
When an at end condition occurs and the statement contains an AT END phrase:
When an at end condition occurs and the statement does not contain an AT END phrase:
When an at end condition does not occur, and no other exception condition exists:
When an at end condition does not occur, and another exception condition does exist:
The INVALID KEY phrase specifies the action your program takes when an invalid key condition is detected (when Status Key 1 contains 2) for the file being processed.
The NOT INVALID KEY phrase specifies the action your program takes when an invalid key condition (or any other error condition) is not detected for the file being processed.
The format is as follows:
stment is one or more imperative statements.
The invalid key condition occurs when the I/O system cannot complete a COBOL DELETE, READ, REWRITE, START, or WRITE statement because of one of the following conditions:
(For more information on these conditions, refer to Section 6.6.8.) When the invalid key condition occurs, execution of the statement that produced the condition is unsuccessful, and the file is unaffected. (For additional information, see the previously mentioned statements.)
When the invalid key condition occurs:
When an invalid key condition does not occur, and no other exception condition exists:
When an invalid key condition does not occur, and another exception condition does exist:
record-name and identifier must not refer to the same storage area.
The result of executing a RELEASE, REWRITE, or WRITE statement with the FROM phrase is equivalent to: (1) executing the statement "MOVE identifier TO record-name" according to the rules of the MOVE statement without the CORRESPONDING phrase, followed by (2) executing the same RELEASE, REWRITE, or WRITE statement without the FROM phrase.
After statement execution ends, the data in the area referenced by
identifier is available to the program. The data is not
available in the area referenced by record-name, unless there
is an applicable SAME clause. (See Section 4.2.10, I-O-CONTROL, the Section 6.8.30
statement, and the Section 6.8.43 statement.)
6.6.12 INTO Phrase
The INTO phrase implicitly moves a current record from the record storage area into an identifier.
The format is as follows:
A READ or RETURN statement can have the INTO phrase if either of the following conditions is true:
Executing a READ or RETURN statement with the INTO phrase is equivalent to: (1) executing the same statement without the INTO phrase, then (2) moving the current record from the record area to the area specified by identifier. The move occurs according to the rules of the MOVE statement without the CORRESPONDING phrase. The move does not occur for an unsuccessful execution of the READ or RETURN statement.
Subscript or index evaluation occurs after the input operation and immediately before the move.
The record is available to the program in both the record area and the
area associated with the identifier.
6.7 Segmentation
HP COBOL programs execute in a virtual memory environment. Therefore, programs need not manage physical memory by overlaying Procedure Division code. HP COBOL provides support for segmentation only for compatibility with existing applications developed on older hardware such as the PDP-11. You should not use segmentation in newly written COBOL programs since segmentation results in the generation of extra code which might impact performance.
Segmentation controls the assignment of Procedure Division sections to fixed or independent segments. The optional segment-number in the section header determines the type of segment.
section-name
names a Procedure Division section.segment-number
must be an integer in the range 0 to 99. If there is no segment-number in a section header, the implied segment-number is 0.
segment-number classifies a segment into fixed segments or independent segments. Sections with segment-numbers from 0 to 49 are in fixed segments. Those with segment-numbers from 50 to 99 are in independent segments.
Sections in the Declaratives part of the Procedure Division must have segment-numbers less than 50.
A segment consists of all sections that have the same segment-number.
Both fixed and independent segments are in their initial state the first time entered. A fixed segment appears to reside in memory at all times and is, therefore, in its last used state each time it is entered.
The state of an independent segment depends on how and when it receives control. On subsequent control transfers, HP COBOL resets the segment's ALTERed GO TO statements to their initial states whenever an independent segment is entered in one of the following ways:
Previous | Next | Contents | Index |