Reputation:
Prod id: XXXXXX
Prod desc:
Prod qty
Prod price
Do you want to delete this record?
By just entering the ID I can access the information about it and ask me if am I going to delete the record.
Can anyone help me? I am a bit new in Cobol. I am using 1985 cobol and running it in Windows Vista OS.
Upvotes: 1
Views: 5741
Reputation: 32528
If the file is opened sequentially then execute a DELETE statement after having READ that record into the program.
If the file is opened random or dynamic then use the DELETE statement with the RELATIVE KEY or RECORD KEY set to the record to be deleted (no need to read the record before the delete).
In both cases the mininum coding for the statement would be:
DELETE file-name.
Upvotes: 1
Reputation: 21950
If you're wanting to delete the current record from , you want something like this:
DELETE file
ON INVALID KEY
what to do
NOT ON INVALID KEY
what to do
END-DELETE
To delete the file itself you want to be in JCL or the local equivalent (e.g. the os).
Upvotes: 1