Previous Topic: DELETE QUEUE (DC/UCF)Next Topic: DELETE TABLE (DC/UCF)


DELETE SCRATCH (DC/UCF)

The DELETE SCRATCH statement deletes one scratch record or all records in the scratch area.

Syntax
►►─── DELETE SCRATCH-─┬──────────────────────────────┬────────────────────────►
                      └─ AREA ID (scratch-area-id ) ─┘

 ►─┬─────────────────────────────────┬────────────────────────────────────────►
   ├─ CURRENT ───────────────────────┤
   ├─ FIRST ─────────────────────────┤
   ├─ LAST ──────────────────────────┤
   ├─ NEXT ──────────────────────────┤
   ├─ PRIOR ─────────────────────────┤
   ├─ ALL ───────────────────────────┤
   └─ RECORD ID (scratch-record-id) ─┘

 ►─┬────────────────────────────────────────────────────┬─ ; ─────────────────►◄
   └─ RETURN RECORD ID INTO (return-scratch-record-id) ─┘
Parameters
AREA ID (scratch-area-id)

Specifies the 1- to 8-character ID of the scratch area associated with the scratch records being deleted. Scratch-area-id is either the symbolic name of a user-defined field that contains the scratch area ID or the ID itself enclosed in single quotation marks. If the AREA ID parameter is not specified, the system assumes an area ID of 8 blanks.

CURRENT

Deletes the current record in the specified scratch area (that is, that record most recently referenced by another scratch function). CURRENT is the default.

FIRST

Deletes the first record in the specified scratch area.

LAST

Deletes the last record in the specified scratch area.

NEXT

Deletes the next record in the specified scratch area.

PRIOR

Deletes the prior record in the specified scratch area.

ALL

Deletes all records in the specified scratch area.

RECORD ID (scratch-record-id)

Deletes the record identified by scratch-record-id. Scratch-record-id is the symbolic name of a user-defined field that contains the ID.

RETURN RECORD ID INTO (return-scratch-record-id)

Specifies the location in the program to which the system will return the ID of the last record deleted by means of the DELETE SCRATCH function. Return-scratch-record-id is the symbolic name of a user-defined 4-byte field.

Example

The following statement deletes the scratch record that is prior to the current scratch record and returns the ID of the deleted record to the SCR_REC_ID field:

DELETE SCRATCH
  PRIOR
  RETURN RECORD ID INTO (SCR_REC_ID);
Status Codes

Upon completion of the DELETE SCRATCH function, the ERROR_STATUS field in the IDMS DC communications block indicates the outcome of the operation:

0000

The request has been serviced successfully.

4303

The requested scratch area ID cannot be found.

4305

The requested scratch record ID cannot be found.

4307

An I/O error has occurred during processing.

4331

The parameter list is invalid.