Deleting a Range of Records

Article ID: 14585

Q: How can I delete a range of records from a DB2 file? I have a flat file in which I store the contents of spooled files. I need a way to delete a specific range of records from any place within the file. Is it possible to delete records by record number?

A: SQL provides an easy way to delete records by relative record number. Consider the following SQL statement:

Delete YourLib/YourFile
  Where RRN(YourFile) Between 101 and 200

This statement would delete records with a relative record number in the range of 101 to 200 from file YourFile in library YourLib.

Gary Guthrie


ProVIP Sponsors

ProVIP Sponsors