# ERASE (VSAM)

## Syntax:

    ERASE(ddname)

## Arguments:

ddname
  is the 1 to 8 character name that identifies the data set you want to process. This name needs to have been previously associated with the data set, either via the ALLOCATE command or JCL DD statement, and opened via the OPEN function.

## Module Name:

SWXERASE

## Service Description:

The ERASE function is used to remove records from KSDSs and RRDSs. VSAM does not honor ERASE requests for ESDSes. Before you can use the ERASE function you must first allocate and open (using the OPEN function) the data set associated with the ddname argument. If you do not, an error will occur. In addition, you must use the GET function (using the UPD option) to retrieve the record you wish to remove before you attempt to ERASE it.

## Returned Information:

The ERASE function returns the VSAM ERASE macro return code. If you CALL the ERASE function, the returned value is contained in the RESULT special variable.

After completion of an ERASE function call, several special REXX variables are populated with useful information. You should treat these variables as "read only" and make no attempt to modify any of them. The variables are:

RC
  Contains the VSAM ERASE return code. Zero means the operation was completed successfully.
REASON
  Contains the VSAM ERASE reason code.

## Examples:

1. After directly retrieving a record for update, remove the record using the ERASE function:

       record = get('iodd','cat','(dir,upd)')
       if rc = 0 then
         call erase 'iodd'

© Copyright 1998 by Open Software Technologies, Inc.