Previous Topic: CA ADS Batch ConsiderationsNext Topic: GET SCRATCH


DELETE SCRATCH

Purpose

Deletes one or all records associated with a particular scratch area id.

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-variable ──┘

 ►──┬────────────────────┬──────── . ─────────────────────────────────────────►◄
    └─ error-expression ─┘

Parameters

AREA ID scratch-area-id

Specifies the area in the data dictionary scratch area to be deleted.

Scratch-area-id is either the name of a variable data field that contains a scratch area id or the 1- to 8-character scratch area id itself, enclosed in single quotation marks.

If scratch-area-id is not specified, a null scratch area id (that is, eight blanks) is assumed.

CURRENT

Deletes the record that is current of the scratch area specified by scratch-area-id.

CURRENT is the default when you specify no other scratch record to be deleted.

FIRST

Deletes the first record in the scratch area specified by scratch-area-id.

LAST

Deletes the last record in the scratch area specified by scratch-area-id.

NEXT

Deletes the record that follows the current record of the scratch area specified by scratch-area-id.

If currency is not established, NEXT is equivalent to FIRST.

PRIOR

Deletes the record that precedes the current record of the scratch area specified by scratch-area-id.

If currency is not established, PRIOR is equivalent to LAST.

ALL

Deletes all records in the scratch area specified by scratch-area-id.

RECORD ID scratch-record-id

Deletes the record identified by scratch-record-id.

Scratch-record-id is either the name of a variable data field that contains the scratch record id or the scratch record id itself, expressed as a numeric constant.

RETURN RECORD ID into return-scratch-record-id-variable

Returns the id of the last scratch record deleted to the location specified by return-scratch-record-id-variable.

Return-scratch-record-id-variable is the name of a numeric variable data field in the dialog's record buffers.

Return-scratch-record-id-variable cannot be a doubleword binary field.

error-expression

Specifies the status codes that are returned to the dialog.

Usage

Considerations If autostatus is not in use, a dialog's error-status field indicates the outcome of a DELETE SCRATCH command:

Status Code

Meaning

0000

The request was executed successfully.

4303

The requested scratch area cannot be found.

4305

The requested scratch record cannot be found.

4307

An I/O error occurred during processing.

4331

The CA ADS internal parameter list is invalid.

Example

The following example illustrates the use of the DELETE SCRATCH command to delete all of the records in scratch area CUSTAREA:

DELETE SCRATCH AREA ID 'CUSTAREA' ALL.

More information:

Error Handling