DB-ERASE deletes a record and all its dependent segments.
DB-ERASE REC segment [FROM dataarea] ... [VIEW pcbname|PCB pcbname]
DB-ERASE REC|REF segment1 [FROM dataarea] ... [VIEW pcbname|PCB pcbname] ... REC|REF segment2 [FROM dataarea] ... [VIEW pcbname|PCB pcbname] . . . ... REC segmentN [FROM dataarea] ... [VIEW pcbname|PCB pcbname]
REC|REF segment |
Specify that the segment name (maximum 8 characters) is in a Working-Storage variable for the program to delete. |
FROM dataarea |
Alternate I/O area where program deletesa record. Required for a record obtained from an I/O area other than the default I/O area, such as by DB-OBTAIN INTO. |
PCB|VIEW pcbname |
Specify PCB used when PSB contains multiple PCBs for the same database. |
DB-OBTAIN REC RECORD-A WHERE KEY-A = VALUE-A ... REC RECORD-B WHERE KEY-B = VALUE-B ... REC RECORD-C WHERE KEY-C = VALUE-C HOLD
DB-ERASE REF RECORD-A ... REC RECORD-B REC RECORD-C
$DB-OBTAIN ("REC SEG1, REC SEG2, REC SEG3")
To delete the entire path:
$DB-ERASE ("REC SEG1")
To delete SEG2 and its dependents:
$DB-ERASE ("REF SEG1, REC SEG2")
To delete just SEG3:
$DB-ERASE (REF SEG1, REF SEG2, REC SEG3")
The following example assumes that the following DB-OBTAIN call precedes the DB-ERASE. This DB-OBTAIN is not a path call and places only SEG3 into the I/O area; therefore, DB-ERASE ignores SEG1 and SEG2:
$DB-OBTAIN ("REF SEG1, REF SEG2, REC SEG3")
To delete SEG3:
$DB-ERASE ("REC SEG3")
The following examples assume that the following DB-OBTAIN path call precedes the DB-ERASE. This DB-OBTAIN places only SEG2 and SEG3 into the I/O area; therefore, DB-ERASE ignores SEG1:
$DB-OBTAIN ("REF SEG1, REC SEG2, REC SEG3")
To delete only SEG3:
$DB-ERASE ("REF SEG2, REC SEG3")
To delete SEG2 and SEG3, which is a dependent of SEG2:
$DB-ERASE ("REC SEG2")
DB-ERASE REC copylibname-REC ... [WHERE column operator [:]altvalue ... [AND|OR column operator [:]altvalue . . . ... AND|OR column operator [:]altvalue]] ... [QUERYNO number] ... [WITH [CS|RS|RR]]
DB-ERASE REC copylibname-REC ... [WHERE CURRENT [OF] cursorname] ... [QUERYNO number] ... [WITH [CS|RS|RR]]
AND|OR column operator [:]altvalue |
Altvalue can be a literal or data name. |
|
REC copylib-REC |
Specify the 01-level name of the COBOL row layout in the DCLGEN or copybook information. Cannot be the same as any cursor names or DB-PROCESS-ID names. |
|
WHERE CURRENT [OF] cursorname |
Valid for cursor processing only. Act upon the row retrieved from cursor. |
|
QUERYNO number |
Specifies the number to be used for this SQL statement in EXPLAIN output and trace records. |
|
WITH |
Specifies the isolation level at which the statement is executed. |
|
CS |
Cursor stability |
|
RS |
Read stability |
|
RR |
Repeatable read |
DB-ERASE REC D2TAB-REC ... WHERE PM_PART_NO = '123' OR PM_PART_NO = '567'
DB-ERASE REC recordname ... WHERE primarykey = value ... [SUB value] [OF|IN dataarea]
DB-ERASE REC recordname
WHERE primarykey = value |
Value can be literal, data name, or an asterisk (*). An asterisk indicates the segment record description contains the key value. |
SUB[SCRIPT] (value) |
Move the subscripted field value to a specified field. Value can be a data name, literal, or an integer. |
OF|IN dataarea |
Qualify the I/O area moving to the value field, when more than one structure in the Data Division contains the field. |
Delete a record where ORDR-NUMBER equals the value in the Working-Storage variable CUST-ORDR-NUMBER.
DB-ERASE REC ORDR-RECORD ... WHERE ORDR-NUMBER = CUST-ORDR-NUMBER
Read a CUST-RECORD for deletion.
DB-OBTAIN REC CUST-RECORD ... WHERE CUST-KEY = SCREEN-CUST-KEY IF OK-ON-REC DB-ERASE REC CUST-RECORD
DB-ERASE REC recordname ... WHERE primarykeyname = value ... [SUB[SCRIPT] value] [OF|IN dataarea] ... [KEYLENGTH|KLEN value] ... [SYSID systemname] [DDN ddname]
DB-ERASE REC recordname
WHERE pri-marykey = value |
Value can be literal, data name, or an asterisk (*). An asterisk indicates the segment record description contains the key value. |
SUB[SCRIPT] (value) |
Move the subscripted field value to a specified field. Value can be a data name, literal, or, under VSAM Batch or Online, an integer. |
OF|IN dataarea |
Qualify the I/O area moving to the value field, when more than one structure in the Data Division contains the field. |
KEYLENGTH| KLEN value |
Specify number or characters in key length; full or partial length is valid. Value can be a number or a data name defined as PIC S9(4) COMP. AMB generates the CICS GENERIC option for a partial key length. |
SYSID systemname |
Process records stored on remote systems. Name a file residing in a remote data set. Systemname can be a 4-character literal region name or a Working-Storage field containing a 4-character region name. |
DDN ddname |
File data description name; supply a value to the name option of CICS DATASET option. Ddname can be a literal or data name defined as PIC X(8). |
Delete a group of ORDR-RECORD records; use partial key length. For successful deletes, store the number of actual records in the AMB data field APS-VSAM-NUMREC.
DB-ERASE REC ORDR-RECORD ... WHERE ORDR-NUMBER = SCREEN-PARTIAL-ORDR-NUMBER KLEN 6 IF OK-ON-REC SCREEN-MSG = 'ORDER RECORDS DELETED, NUMBER ORDERS = ' SCREEN-NBR-RECS = APS-VSAM-NUMREC
Hold a CUST-RECORD for deletion.
DB-OBTAIN REC CUST-RECORD ... WHERE CUST-KEY = SCREEN-CUST-KEY HOLD IF OK-ON-REC DB-ERASE REC CUST-RECORD