Delete a record from COBOL/400 file

535 pts.
Tags:
COBOL
COBOL statements
COBOL/400
PGM
In COBOL/400 PGM the file has been declared with ACCESS as SEQUENTIAL and ORGANIZATION as SEQUENTIAL. How to delete a record from such file?




Software/Hardware used:
COBOL/400

Answer Wiki

Thanks. We'll let you know when a new response is added.

The Deletion Operation on a PF is very similar to UPDATE operation.
For Deleting a Record, We first need to Read and Lock the corresponding Record, Then we can delete the record.

As you mentioned, The PF is declared as SEQUENTIAL, The Read Operation will be sequential. You can have a condition for finding the record which needs to be deleted and can use the DELETE command for deleting a Record.

Pradeep.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Also, note that the OPEN must be coded I-O rather than just INPUT. Tom
    125,585 pointsBadges:
    report
  • mvrkrishna
    If the file has ACCESS is SEQUENTIAL, we cannot use the START keyword for placing the file pointer, ACCESS will happen as per the RRN. Since the file pointer cannot be placed at a particular record the application is not allowing me to delete a record.
    535 pointsBadges:
    report
  • RichK1151
    You can declare the file as RELATIVE in your Cobol program. As long as you know the RRN you can set your relative key to that record, read it then delete it.
    125 pointsBadges:
    report
  • TomLiotta
    Since the file pointer cannot be placed at a particular record the application is not allowing me to delete a record. The question is not making total sense. If you want to position to a particular record and then DELETE it, why is the file defined with ACCESS as SEQUENTIAL? Change the ACCESS to RANDOM or DYNAMIC. And if you want to DELETE, change from ORGANIZATION as SEQUENTIAL to RELATIVE or INDEXED. What exactly do you want to do? Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following