# Compaq COBOL
Reference Manual

Previous | Contents | Index

# Appendix C
File Status Values

This appendix summarizes the values that can appear in FILE STATUS data items. The entry for each statement describes specific causes for each condition.

You may receive different file status values depending upon whether you use the `standard` compiler option with the `v3` or `85` setting. Table C-1 lists all file status values in numeric order for the default `85` setting. Table C-2 lists the corresponding file status values for the `v3` and `85` settings.

For more information about the `standard` compiler option, on a Tru64 UNIX system, refer to the COBOL man page. On an OpenVMS system, invoke the online help for COBOL.

Table C-1 I-O File Status Values for the Default `-std 85` Flag or /STANDARD =85 Qualifier Option
File Status | Input/Output Statements | File Organization | Access Mode | Meaning
--- | --- | --- | --- | ---
00 | All | All | All | Successful
02 | REWRITE WRITE | Ind | All | Created duplicate alternate key
02 | READ | Ind | All | Detected alternate duplicate key
04 | READ | All | All | Record not size of user's buffer
05 | OPEN | All | All | Optional file not present
07 | CLOSE OPEN | All | All | Invalid file organization or device
10 | READ | All | Seq | No next logical record or option file not present (at end)
14 | READ | Rel | All | Relative record number too large
21 | REWRITE | Ind | Seq | Primary key changed after READ
21 | WRITE | Ind | Seq | Attempted nonascending key value (invalid key)
22 | REWRITE | Ind | All | Duplicate alternate key (invalid key)
22 | WRITE | Ind, Rel | Ran | Duplicate key (invalid key)
23 | DELETE READ REWRITE START | Ind, Rel | Ran | Record not in file; optional file not present (invalid key)
24 | WRITE | Ind, Rel | All | Boundary violation or relative record number too large (invalid key)
30 | All | All | All | All other permanent errors
34 | WRITE | Seq | Seq | Boundary violation
35 | OPEN | All | All | File not found
37 | OPEN | All | All | Inappropriate device type
38 | OPEN | All | All | File previously closed with lock
39 | OPEN | All | All | Conflict of file attributes
41 | OPEN | All | All | File already opened
42 | CLOSE | All | All | File not opened
43 | DELETE REWRITE | All | Seq | No previous READ or START
44 | REWRITE WRITE | All | All | Invalid record size
46 | READ | All | Seq | No valid next record (at end)
47 | READ START | All | All | File not open, or incompatible open mode
48 | WRITE | All | All | File not open, or incompatible open mode
49 | DELETE REWRITE | All | All | File not open, or incompatible open mode
90 | All | All | All | Record locked by another user (record available)
91 | OPEN | All | All | Open is unsuccessful; file locked by another access stream
92 | DELETE READ REWRITE START WRITE | All | All | Record locked by another user (record not available)
93 | UNLOCK | All | All | No current record
94 | UNLOCK | All | All | File not open, or incompatible open mode
95 | OPEN | All | All | No file space on device

Table C-2 I-O File Status Values for the V3 and 85 Options
I-O Error Condition | Status Value
--- | ---
| V3 | 85
READ successful---record shorter than fixed file attribute. | 00 | 04
CLOSE reel/unit attempted on nonreel/unit device. | 00 | 07
READ fails---relative key digits exceed relative key. | 00 | 14
WRITE fails---relative key digits exceed relative key. | 00 | 24
OPEN I-O on file that is not mass storage. | 00 | 37
WRITE fails---attempt to write a record of a different size than in the file description. | 00 | 44
READ fails---no next logical record (EOF detected). | 13 | 10
READ fails---no next logical record (EOF on OPTIONAL file). | 15 | 10
READ fails---no valid next record (already at EOF). | 16 | 10
READ NEXT or sequential READ---no valid next record pointer. | 16 1 | 46 1
READ or START fails---optional input file not present. | 25 | 23
READ successful---record longer than fixed file attribute. | 30 | 04
OPEN on relative or indexed file that is not mass storage. | 30 | 37
REWRITE fails---attempt to rewrite record of different size. | 30 | 44
CLOSE fails---file not currently open. | 94 | 42
DELETE or REWRITE fails---previous I-O not successful READ. | 93 | 43
OPEN fails---file previously closed with LOCK. | 94 | 38
OPEN fails---file created with different organization. | 94 | 39
OPEN fails---file created with different prime record key. | 94 | 39
OPEN fails---file created with different alternate record keys. | 94 | 39
OPEN fails---file currently open. | 94 | 41
READ or START fails---file not opened INPUT or I-O. | 94 | 47
WRITE fails---file not opened OUTPUT, EXTEND, or I-O. | 94 | 48
DELETE or REWRITE fails---file not opened I-O. | 94 | 49
OPEN INPUT on a nonoptional file---file not found. | 97 | 35

1Refer to the description of the /STANDARD qualifier in the COBOL online help file, or the Compaq COBOL User Manual for the description of the -std flag, for information about the No Valid Next Record Condition.

# Appendix D
Report Writer Presentation Rules and Tables

The tables and rules in this appendix specify the following:

- The permissible combinations of LINE NUMBER and NEXT GROUP clauses for each type of report group
- The requirements for the use of these clauses
- The interpretation that the Report Writer Control System (RWCS) gives to these clauses

# D.1 Organization

There is an individual presentation rules table for each of the following types of report groups: REPORT HEADING, PAGE HEADING, PAGE FOOTING, and REPORT FOOTING. In addition, DETAIL report groups, CONTROL HEADING report groups, and CONTROL FOOTING report groups are treated jointly in the Body Group Presentation Rules Table.

Columns 1 and 2 of a presentation rules table list all of the permissible combinations of LINE NUMBER and NEXT GROUP clauses for the designated report group type. Consequently, to identify the set of presentation rules that applies to a particular combination of LINE NUMBER and NEXT GROUP clauses, read a presentation rules table from left to right along the selected row.

The applicable rules columns of a presentation rules table are divided into two parts. The first part specifies the rules that apply if the report description contains a PAGE clause, and the second part specifies the rules that apply if the PAGE clause is omitted. The explanation of the rules named in the applicable rules columns follows:

- Upper-limit rules and lower-limit rules:
  These rules specify the vertical subdivisions of the page within which the RWCS may present the specified report group when the PAGE clause is used.
- Fit test rules:
  The fit test rules are applicable only to body groups when the PAGE clause is included in the Report Description entry. Therefore, fit test rules are specified only within the Body Group Presentation Rules Table. The RWCS applies the fit test rules to determine whether the designated body group can be presented on the page on which the report is currently positioned.
- First print line position rules:
  The first print line position rules specify where on the page the RWCS presents the first print line of the given report group.
  The presentation rules tables do not specify where on the page the RWCS presents the second and subsequent print lines (if any) of a report group; this is determined by the general rules of the LINE NUMBER clause.
- Next group rules:
  The next group rules relate to the proper use of the NEXT GROUP clause.
- Final LINE-COUNTER setting rules:
  These rules specify the values that the RWCS places in LINE-COUNTER after presenting report groups.

# D.2 LINE NUMBER Clause Notation

Column 1 of the presentation rules table uses a shorthand notation to describe the sequence of LINE NUMBER clauses that may appear in the description of a report group. The meaning of the abbreviations used in column 1 is as follows:

1. The letter A represents one or more absolute LINE NUMBER clauses that appear in consecutive order within the sequence of LINE NUMBER clauses in the Report Group Description entry. None of the absolute LINE NUMBER clauses may have a NEXT PAGE phrase.
2. The letter R represents one or more relative LINE NUMBER clauses that appear in consecutive order within the sequence of LINE NUMBER clauses in the Report Group Description entry.
3. The letters NP represent one or more absolute LINE NUMBER clauses that appear in consecutive order within the sequence of LINE NUMBER clauses within the NEXT PAGE phrase appearing in the first, and only the first, LINE NUMBER clause.
4. When two abbreviations appear together, they refer to a sequence of LINE NUMBER clauses that consist of the two specified consecutive sequences. For example, A R refers to a Report Group Description entry within which the A sequence (defined in rule 1) is immediately followed by the R sequence (defined in rule 2).
5. A blank entry indicates that the clause is absent from the Report Group Description entry.

# D.3 LINE NUMBER Clause Sequence Substitutions

Where A R is a permissible sequence in the presentation rules table, A is also permissible, and the same presentation rules apply.

Where NP R is a permissible sequence in the presentation rules table, NP is also permissible, and the same presentation rules apply.

# D.4 Saved-Next-Group-Integer Description

Saved-next-group-integer is a data item that is addressable only by the RWCS. When an absolute NEXT GROUP clause specifies a vertical positioning value that cannot be accommodated on the current page, the RWCS stores that value in saved-next-group-integer. After page-advance processing, the RWCS positions the next body group using the value stored in saved-next-group-integer.

# D.5 REPORT HEADING Group Presentation Rules

Figure D-1 points to the appropriate presentation rules for all permissible combinations of LINE NUMBER and NEXT GROUP clauses in a REPORT HEADING report group.

Figure D-1 REPORT HEADING Group Presentation Rules

REPORT HEADING Group Presentation Rules

1. Upper-limit rule:
   The first line number on which the REPORT HEADING report group can be presented is the line number specified by the HEADING phrase of the PAGE clause.
2. Lower-limit rules:
   1. The last line number on which the REPORT HEADING report group can be presented is the line number that is obtained by subtracting 1 from the first-detail-line value of the FIRST DETAIL phrase of the PAGE clause.
   2. The last line number on which the REPORT HEADING report group can be presented is the line number specified by page-size of the PAGE clause.
3. First print line position rules:
   1. The first print line of the REPORT HEADING report group is presented on the line number specified by the integer of its LINE NUMBER clause.
   2. The first print line of the REPORT HEADING report group is presented on the line number obtained by adding the integer of the first LINE NUMBER clause and the value obtained by subtracting 1 from the heading-line value of the HEADING phrase of the PAGE clause.
   3. The REPORT HEADING report group is not presented.
   4. The first print line of the REPORT HEADING report group is presented on the line number obtained by adding the contents of its LINE-COUNTER (in this case, zero) to the integer of the first LINE NUMBER clause.
4. Next group rules:
   1. The NEXT GROUP integer must be greater than the line number on which the final print line of the REPORT HEADING report group is presented. In addition, the NEXT GROUP integer must be less than the line number specified by first-detail-line of the FIRST DETAIL phrase of the PAGE clause.
   2. The sum of the NEXT GROUP integer and the line number on which the final print line of the REPORT HEADING report group is presented must be less than the value of first-detail-line of the FIRST DETAIL phrase of the PAGE clause.
   3. NEXT GROUP NEXT PAGE signifies that the REPORT HEADING report group will appear by itself on the first page of the report. The RWCS processes no other report group while positioned at the first page of the report.
5. Final LINE-COUNTER setting rules:
   1. After the REPORT HEADING report group is presented, the RWCS places the NEXT GROUP integer into LINE-COUNTER as the final LINE-COUNTER setting.
   2. After the REPORT HEADING report group is presented, the RWCS places the sum of these two items into LINE-COUNTER as the final LINE-COUNTER setting:
      - The NEXT GROUP integer
      - The line number on which the final print line of the REPORT HEADING report group was presented
   3. After the REPORT HEADING report group is presented, the RWCS places zero into LINE-COUNTER as the final LINE-COUNTER setting.
   4. After the REPORT HEADING report group is presented, the final LINE-COUNTER setting is the line number on which the final print line of the REPORT HEADING report group was presented.
   5. LINE-COUNTER is unaffected by the processing of a nonprintable report group.

# D.6 PAGE HEADING Group Presentation Rules

Figure D-2 shows the appropriate presentation rules for all permissible combinations of LINE NUMBER and NEXT GROUP clauses in a PAGE HEADING report group.

Figure D-2 PAGE HEADING Group Presentation Rules Table

PAGE HEADING Group Presentation Rules

1. Upper-limit rule:
   If a REPORT HEADING report group has been presented on the page on which the PAGE HEADING report group is to be presented, then the first line number on which the PAGE HEADING report group can be presented is one greater than the final LINE-COUNTER setting established by the REPORT HEADING.
   Otherwise, the first line number on which the PAGE HEADING report group can be presented is the line number specified by the HEADING phrase of the PAGE clause.

2. Lower-limit rule:
   The last line number on which the PAGE HEADING report group can be presented is the line number obtained by subtracting 1 from the first-detail-line value of the FIRST DETAIL phrase of the PAGE clause.
3. First print line position rules:
   1. The first print line of the PAGE HEADING report group is presented on the line number specified by the integer of its LINE NUMBER clause.
   2. If a REPORT HEADING report group has been presented on the page on which the PAGE HEADING report group is to be presented, then the sum of the following two items defines the line number on which the first print line of the PAGE HEADING report group is presented:
      - The final LINE-COUNTER setting established by the REPORT HEADING report group
      - The integer of the first LINE NUMBER clause of the PAGE HEADING report group
      Otherwise, the sum of the following two items defines the line number on which the first print line of the PAGE HEADING report group is presented:
      - The integer of the first LINE NUMBER clause of the PAGE HEADING report group
      - The value obtained by subtracting 1 from the heading-line value of the HEADING phrase of the PAGE clause
   3. The PAGE HEADING report group is not presented.
4. Final LINE-COUNTER setting rules:
   1. The final LINE-COUNTER setting is the line number on which the final print line of the PAGE HEADING report group was presented.
   2. LINE-COUNTER is unaffected by the processing of a nonprintable report group.

Previous | Next | Contents | Index