Reputation: 29
I am trying to delete the entire records in a KSDS VSAM file using CICS command. But the thing is that the EXEC CICS DELETE will delete just one record. I foundout that there is a GENERIC option that can be paired with NUMREC to delete a specific number of records. But still it doesnnt solve the problem of deleting all records. Is there any way to remove all records in a VSAM file.
Upvotes: 0
Views: 282
Reputation: 31
If its a VSAM RLS file, then you can use the browse for update capability, ie you can browse through the file using READNEXT commands speciying UPDATE and a token. For each record returned you issue a DELETE command using the token returned from the READNEXT command.
If its a non RLS VSAM file, then you'd have to do it using a sequence of READ UPDATE commands specifying a TOKEN and then issuing a DELETE using the token. On the READ UPDATE command if you use the GTEQ option it will retrieve the next record with a key greater than or equal to the key you specify. So start with a null key and using GTEQ will find you the first record. On the next READ UPDATE with GTEQ if you use the previously found key, it will retrieve the next record after that. And so on.
Upvotes: 1