# DSNDEL (Data Set Delete)

## Syntax:

    DSNDEL(dsnpattern[,options][,catalog])

## Arguments:

dsnpattern
  is the 1 to 64 character name that identifies the data set or data sets you want to delete. If dsnpattern contains single quotes, it is assumed to be fully qualified. If not, the current userid (as given by IRXUID) will be appended to the front of the argument.
  - You may use DELETE command wild card characters to delete (possibly) more than one data set per invocation.
  - You may specify a password for the data set, using the form dsname/password.
options
  is the 1 to 80 byte string containing DELETE command data set name qualifiers and options. For example, you can use this argument to specify the SCRATCH option which causes the data set's VTOC information to be removed. If you supply more than one DELETE command operand, they must be separated by at least one blank. The interface does not check this string for errors. If any keyword is incorrect, IDCAMS will detect the error.
catalog
  is the catalog containing the entry for the data set to be deleted. If a password is required use the form catalog/password. The catalog name must be fully qualified, without quotes. Userid is never appended to the catalog name.

## Module Name:

SWXDSNDL

## Service Description:

The DSNDEL function is used to invoke the IDCAMS DELETE command. Using this function you can:

- Remove a data set's catalog information.
- Remove a data set's VTOC information.
- Clear the space the data set occupied with binary zeros.

Notes:

1. The DSNDEL constructs a DELETE command of the form:

       DELETE dsnpattern [options] [CATALOG(cat/pw)]

   Because of this you cannot specify multiple patterns in the dsnpattern argument. You may, however, use IDCAMS wild card characters to delete more than one data set.
2. You cannot scratch (remove from the VTOC) a data set that is not cataloged. Use the SCRATCH function of IEHPROGM.
3. Refer to the Access Method Services publication for your system's level of DFP or DFSMS for more information on the DELETE command.

## Returned Information:

The DSNDEL function returns the IDCAMS return code. If you CALL the DSNDEL function, the returned value is contained in the RESULT special variable. The RC variable is unchanged (unless you assign the return code to it). A return code of zero always indicates success.

The DSNDEL function returns any "IDC" messages produced the DELETE command. The messages are returned in a special array whose stem is $SWXIDCMS. The zeroth element ($SWXIDCMS.0) contains the number of messages produced by the command.

Notes:

1. Only "IDC" messages are returned in the $SWXIDCMS. stem array. The messages are not in "ready-to-print" format (i.e., there are no printer control characters).
2. The function performs a REXX drop on the $SWXIDCMS. stem prior to executing the DELETE command.
3. The function performs a MARGINS command prior to executing the DELETE command. Because of this, the first IDC message in the $SWXIDCMS. stem array is the "FUNCTION COMPLETED" message for the MARGINS command.

## Examples:

1. Uncatalog a data set. The function will automatically append the userid. The data set is not removed from the VTOC:

       if dsndel("user.data","noscratch") = 0 then
         say 'Deleted.'

2. Uncatalog and scratch a data set from the VTOC. The data set name is fully qualified:

       call dsndel "'sys1.locproc'", 'scratch'

3. Delete a member of a partitioned data set. The userid is automatically appended:

       if dsndel("user.exec(mem01)") = 0 then
         say 'Deleted.'

© Copyright 1998 by Open Software Technologies, Inc.