Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

I-O status

The status of each access operation performed on a file is stored by the runtime system in specific data items which can be assigned to every file in the program. These items, which are specified by using the FILE STATUS clause, provide information on

  • whether the I/O operation was successful, and

  • the type of any errors that may have occurred.

This data can be evaluated (by USE procedures in the DECLARATIVES, for example) and used by the program to analyze I-O errors. As an extension to Standard COBOL, COBOL2000 provides the option of including the keys of the POSIX error messages in this analysis, thus allowing a finer differentiation between different causes of errors. The FILE STATUS clause is specified in the FILE-CONTROL paragraph of the Environment Division. Its format is described in section "I-O status".

The functions of the two data items definable in the FILE STATUS clause are as follows:

data-name-1

contains a two-character numeric status code following each access operation on the associated file.

data-name-2

is broken down into data-name-2-1 and data-name-2-2 and is used for storing the (POSIX) SIS codes for the relevant I-O status. Following each access operation on the associated file, it contains a value that directly depends on the content of data-name-1. The value can be derived from the table below:

Content of
data-name-1 not equal 0?

SIS code
not equal 0?

Value of
data-name-2-1

Value of
data-name-2-2

no

not relevant

undefined

undefined

yes

no

0

undefined

yes

yes

96

SIS code of the associated error message

For program execution in BS2000, the meaning text of each SIS code can be output using the command HELP-MSG-INFORMATION SIS<data-name-2-2>.

The base and extended I-O status values are described in the two tables that follow.

Base I-O status

Value

Org *)

Meaning

0x


Execution successful

00
02
04
05
07

SRI
I
SRI
SRI
S

No further information
Successful READ, allowable duplicate key
Successful READ, but record length error
Successful OPEN on nonexistent OPTIONAL file
- Successful OPEN with NO REWIND
- Successful CLOSE with NO REWIND, REEL/UNIT or FOR REMOVAL

1x


Execution unsuccessful: AT END condition

10
14

SRI
R

Unsuccessful READ - end of file reached
Unsuccessful READ - key item length error

2x


Execution unsuccessful, key error

21
22
23
24

I
RI
RI
RI

Incorrect key sequence on sequential access
WRITE for existing record
READ for nonexistent record
Key item length error

3x


Execution unsuccessful, unrecoverable error

30
34
35
38
39

SRI
S
SRI
SRI
SRI

No further information (check SIS code)
Insufficient secondary allocation in CREATE-FILE or MODIFY-FILE-ATTRIBUTES command
OPEN INPUT/I-O on nonexistent file
OPEN for file closed using CLOSE WITH LOCK
OPEN error due to incorrect file attributes

4x


Execution unsuccessful, logical error

41
42
43

44
46

47


48
49

SRI
SRI
S
RI
SRI
S
RI
S
RI
SRI
S
RI

OPEN for a file which is already open
CLOSE for a file which is not open
REWRITE not preceded by successful READ
DELETE/REWRITE not preceded by successful READ
WRITE/REWRITE with invalid record length
Repeated READ after unsuccessful READ or after detection of AT END
Sequential READ after unsuccessful READ/START or after detection of AT END
READ for file not opened for reading
READ/START for file not opened for reading
WRITE for file not opened for writing
REWRITE for file not opened in I-O mode
DELETE/REWRITE for file not opened in I-O mode

9x


Other conditions with unsuccessful execution

90
91
96

SRI
SRI
R1

System error, no further information
OPEN error or no free device
READ PREVIOUS is not supported

*) S = sequential organization, R = relative organization, I = indexed-sequential organization

Extended I-O status - (SIS code)

I/O status

Meaning

0601

End-of-file detected

0602

Specified record does not exist

0603

Specified record exists

0604

Start-of-file detected

0605

Specified link does not exist

0606

File name longer than P_MAXFILENAME

0607

Path string longer than P_MAXPATHSTRG

0608

Path name longer than P_MAXPATHNAME

0609

Link name longer than P_MAXLINKNAME

0610

Out of memory

0611

Number of path elements exceeds P_MAXHIERARCHY

0612

Function not supported

0613

File name missing or syntactically incorrect

0614

Number of secondary keys exceeds P_MAXKEYS

0615

Too many files open at once

0616

Specified file does not exist

0617

Write access not allowed

0618

No file name specified

0619

File is locked

0620

Invalid combination of file attributes

0621

Invalid file handling specified

0622

Current record shorter than MINSIZE

0623

Current record longer than MAXSIZE

0625

No sequential READ before sequential REWRITE

0626

Invalid record format

0627

MINSIZE larger than MAXSIZE

0628

Invalid file organization

0629

File exists though declared as nonexistent

0630

Specified access function not allowed

0631

Specified key

0632

Key duplication not allowed

0633

Current record is locked

0634

Current key out of sequence

0635

Specified path undefined

0636

System-specific error occurred

0637

End-of-line reached

0638

Record truncated

0640

No space available to extend file

0643

Invalid file open mode

0644

Length of link exceeds P_MAXLINKSTRG

0645

Invalid version string specified

0646

Specified file lifespan invalid

0647

Syntax error in file, link or path string

0649

File close mode invalid

0650

Access denied

0651

Parameter error

0652

Invalid pointer to I/O area

0653

Invalid record length detected

0654

Storage limits reached on device

0655

Specified feed control invalid

0656

Specified code invalid

0657

Invalid combination of open mode and file lifespan

0658

I/O aborted

0659

Length of key identifier exceeds P_MAXKEYWORD

0660

Key identifier ambiguous

0661

Number of exits exceeds P_MAXEXITS

0662

New line detected

0663

New page detected

0664

Not all paths closed

0665

Next indexed record has same secondary key

0666

Secondary key of written record already exists

0667

Current record number exceeds MAX_REC_NR

0668

Path name already exists

0669

Link name already exists

0670

Specified value for positioning condition invalid

0671

Unknown control character detected

0672

A unique file name could not be generated

0673

Last record incomplete; function not executed

0674

Specified value for positioning invalid

0675

Unidentifiable record format

0676

Unidentifiable MAXSIZE

0677

Internal PROSOS-D error

0678

Specified file is a file container

0679

Specified file cannot be reached on given path

0680

Version not incrementable

0681

Defective reopen after implicit close

0682

Defective PROSOS-D initialization

0683

Number of link indirections exceeds P_MAXLINKNESTING