Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Status 23 while attempting to delete record from an indexed file 1

Status
Not open for further replies.

sachinbaby

Programmer
Jun 30, 2008
1
ZA
While attempting to delete an existing record from an indexed file, the cobol program reports an error "23".

Am able to read the record successfully (which I am attempting to delete), the key value displayed is also correctly;however if i attempt to delete the read record it returns error status "23".

The description of Error "23" is "An attempt was made to randomly access a record that does not exist in the file, or a START or random READ statement was attempted on an optional input file that was not present."

Note: I have noted that if I set the duplicate clause "no" in the describe/definition file (which is used to build the file) and reload the file, then am able to succesfully delete the record. However, I want the program to delete the record with value of 'duplicate' variable set to "yes" in the file definition file.

Portion of program attached for reference:

SELECT AAAFLE ASSIGN TO WS1-AAAFLE
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS AAA-KEY WITH DUPLICATES
LOCK MODE IS AUTOMATIC WITH LOCK ON RECORD
FILE STATUS IS E00-ERROR-STATUS.


Start Section
--------------

START AAAFLE KEY >= AAA-KEY
INVALID KEY
...
NOT INVALID KEY
...
END-START.

Read Section
-------------

READ AAAFLE NEXT WITH LOCK
AT END
MOVE "Y" TO WS-EOF
NOT AT END
...
END-READ.


Delete Section
----------------

DELETE AAAFLE RECORD

INVALID KEY DISPLAY "INVALID KEY"

END-DELETE.

 
If you're allowing duplicates on your primary key, you are bound to pick up problems with your read , delete and rewrite statements.
This is because, with duplicates allowed on primary keys, you cannot uniquely identify records within a file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top