96 lines
7.2 KiB
HTML
96 lines
7.2 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Delete database records" />
|
||
|
<meta name="abstract" content="The delete operation allows you to delete an existing database record." />
|
||
|
<meta name="description" content="The delete operation allows you to delete an existing database record." />
|
||
|
<meta name="DC.subject" content="deleting, database record, record" />
|
||
|
<meta name="keywords" content="deleting, database record, record" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafobasicop.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafomngprgz.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbaforsdlt.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbafomngpinz.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbaforzahftra.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rbaforzahfrca.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rbafodldbr" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Delete database records</title>
|
||
|
</head>
|
||
|
<body id="rbafodldbr"><a name="rbafodldbr"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Delete database records</h1>
|
||
|
<div><p>The delete operation allows you to delete an existing database
|
||
|
record.</p>
|
||
|
<div class="p">The DELET statement in the RPG/400<sup>®</sup> language and the DELETE statement
|
||
|
in the COBOL/400<sup>®</sup> language
|
||
|
are examples of this operation. To delete a database record, the record must
|
||
|
first be read and locked. The record is locked by specifying the update option
|
||
|
on any of the read operations listed under <a href="rbafordbra.htm#rbafordbra">Read database records using an arrival sequence access path</a> or <a href="rbafordbrk.htm#rbafordbrk">Read database records using a keyed sequence access path</a>. The rules for locking records for
|
||
|
deletion and identifying which record to delete are the same as for update
|
||
|
operations. <div class="note"><span class="notetitle">Note:</span> Some high-level languages do <em>not</em> require that you
|
||
|
read the record first. These languages allow you to specify which record you
|
||
|
want deleted on the delete statement. For example, the RPG/400 language allows you to delete
|
||
|
a record without first reading it.</div>
|
||
|
</div>
|
||
|
<p>When a database record is deleted, the physical record is marked as deleted.
|
||
|
This is true even if the delete operation is done through a logical file.
|
||
|
A deleted record <em>cannot</em> be read. The record is removed from all keyed
|
||
|
sequence access paths that contain the record. The relative record number
|
||
|
of the deleted record remains the same. All other relative record numbers
|
||
|
within the physical file member do not change.</p>
|
||
|
<div class="p">The space used by the deleted
|
||
|
record remains in the file, but it is not reused until: <ul><li>The Reorganize Physical File Member (RGZPFM) command is run to compress
|
||
|
and free these spaces in the file member. </li>
|
||
|
<li>Your program writes a record to the file by relative record number and
|
||
|
the relative record number used is the same as that of the deleted record.</li>
|
||
|
</ul>
|
||
|
<div class="note"><span class="notetitle">Note:</span> The system tries to reuse deleted record space automatically if
|
||
|
the file has the reuse deleted record space attribute specified.</div>
|
||
|
</div>
|
||
|
<p>The system does not allow you to retrieve the data for a deleted record.
|
||
|
You can, however, write a new record to the position (relative record number)
|
||
|
associated with a deleted record. The write operation replaces the deleted
|
||
|
record with a new record. See your high-level language topic collection for
|
||
|
more details about how to write a record to a specific position (relative
|
||
|
record number) in the file.</p>
|
||
|
<p>To write a record to the relative record number
|
||
|
of a deleted record, that relative record number must exist in the physical
|
||
|
file member. You can delete a record in the file using the delete operation
|
||
|
in your high-level language. You can also delete records in your file using
|
||
|
the Initialize Physical File Member (INZPFM) command. The INZPFM command can
|
||
|
initialize the entire physical file member to deleted records. </p>
|
||
|
<p>If the file from which you are deleting has a delete trigger associated
|
||
|
with it, the trigger program is called before or after deleting the record.</p>
|
||
|
<p>If the file is part of a referential constraint relationship, record deletion
|
||
|
might be affected. </p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafobasicop.htm" title="These topics describe basic database file operations, including the read, update, write and delete operations.">Basic database file operations in programs</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="rbafomngprgz.htm" title="These topics describe how to reorganize physical files on the i5/OS operating system, how to suspend or cancel reorganize operations and what type of reorganize operations you can choose. Considerations for reorganizing physical files are also included.">Reorganize a physical file</a></div>
|
||
|
<div><a href="rbaforsdlt.htm" title="Sometimes you might want to reuse deleted records for your database files. In this case, you can use the REUSEDLT parameter.">Reuse deleted records</a></div>
|
||
|
<div><a href="rbafomngpinz.htm" title="To use relative record processing in a program, the database file must contain a number of record positions equal to the highest relative record number used in the program. Programs using relative-record-number processing sometimes require that these records be initialized.">Initialize data in a physical file member</a></div>
|
||
|
<div><a href="rbaforzahftra.htm" title="A trigger is a set of actions that run automatically when a specified change or read operation is performed on a specified database file. On iSeries, you define a set of trigger actions in any supported high-level language.">Trigger automatic events in your database</a></div>
|
||
|
<div><a href="rbaforzahfrca.htm" title="These topics discuss how to use referential constraints in your database to ensure that it contains only valid data.">Ensure data integrity with referential constraints</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|