DLET command
The Delete (DLET
) command is used to remove
a segment and its dependents from the database.
Format
Options
- USING PCB(expression)
- Specifies the DB PCB you want to use for the command. Its argument can be any expression that converts to the integer data type; you can specify either a number or a reference to a halfword in your program containing a number.
- VARIABLE
- Indicates that a segment is variable-length.
- SEGMENT(name)
- Qualifies the command, specifying the name of the segment type you want to retrieve, insert, delete, or replace.
- SEGMENT((area))
- Is a reference to an area in your program containing the name of the segment type. You can specify an area instead of specifying the name of the segment in the command.
- SEGLENGTH(expression)
- Specifies the length of the I/O area into which the segment is
retrieved. Its argument can be any expression that converts to the
integer data type; you can specify either a number or a reference
to a halfword in your program containing a number. (It is required
in COBOL programs for any SEGMENT level that specifies the INTO or
FROM option.)
Requirement: The value specified for SEGLENGTH must be greater than or equal to the length of the longest segment that can be processed by this call.
- FROM(area)
- Specifies an area containing the segment to be added, replaced, or deleted. Use FROM to insert one or more segments with one command.
- SETZERO(data_value)
- Specifies setting a subset pointer to zero.
Usage
You use the DLET
command
to delete a segment and its dependents from the database. You must
first retrieve segments you want to delete, just as if you were replacing
segments, The DLET
command deletes the retrieved
segment and its dependents, if any, from the database.
Example
Evelyn Parker has
moved away from this area. Her patient number is 10450. Delete her
record from the database.
You want to delete all the information about Evelyn Parker from the database. To do this, you must delete the PATIENT segment. When you do this, DL/I deletes all the dependents of that segment. This is exactly what you want DL/I to do—there is no reason to keep such segments as ILLNESS and TREATMNT for Evelyn Parker if she is no longer one of the clinic's patients.
EXEC DLI GU
SEGMENT(PATIENT) INTO(PATAREA) WHERE (PATNO=PATNO1);
DLET
command
and use the FROM option to give the name of the I/O area that contains
the segment you want deleted: EXEC DLI DLET SEGMENT(PATIENT) FROM(PATAREA);
When you issue this command, the PATIENT segment, and its dependents—the ILLNESS, TREATMNT, BILLING, PAYMENT, and HOUSHOLD segments—are deleted.
Restrictions
You
cannot issue any commands using the same PCB between the retrieval
command and the DLET
command, and you can issue only
one DLET
command for each GET
command.