Mainframe Tutorial-CICS File Control Commands-DELETE Command

The DELETE command
{ DELETE DATASET(filename) | FILE(name) }
[ RIDFLD(data-area)
[ KEYLENGTH(data-value)
[ NUMREC(data-area) ] ] ] ]
[ RBA | RRN ]
[ SYSID(name) ]

DATASET or FILE Specifies a 1 to 8 character name for the datset as specified using CEDA DEFINE FILE(name)

RIDFLD Specifies a data area that has the key of the record to be deleted. If omitted, the record must have been fetched using a READ with the UPDATE option. If RRN or RBA is not specified this field contains the key of the KSDS record to be deleted.

KEYLENGTH A binary half word (PIC S9(4) COMP) field used to specify the length of a GENERIC key. Used for a generic delete along with the GENERIC option. This field must be specified along with SYSID option. Not valid if RBA or RRN is specified.

GENERIC Specifies that the delete is a generic delete.

NUMREC Is set by CICS to the number of records that have been deleted for a generic delete.

RBA Specifies that the RIDFLD contains a RBA for a VSAM KSDS record. It is a binary full word field PIC S9(8) COMP.

RRN Specifies that the RIDFLD contains a RRN for a VSAM RRDS record. It is a binary full word field PIC S9(8) COMP. Note that RRN’s start from 1.

SYSID Specifies a 1 to 4 character connection name that represents a remote system.

The RESP field can have the following values:-

DISABLED file is disabled using CEMT SET

DSIDERR File is not defined to CICS. In later systems also indicated by FILENOTFOUND.

DUPKEY Another record with the specified key also exists in the file when the file access is via an alternate index. The DELETE deletes only the first record.

ILLOGIC A serious VSAM error occurred

INVREQ The DELETE operation is not enabled for this File when it was defined using CEDA. It can also occur if the RIDFLD is not specified and the DELETE was not preceded by a READ with the UPDATE option.

IOERR An IOERR occurred

NOTAUTH The transaction’s definition specified resource Checking and the operator is not authorized to Access the data set.
NOTOPEN the data set is not open

NOTFND The specified record could not be found.

SYSIDERR The system identified by SYSID could not be found.

  • For recoverable files, the DELETE command causes your task to hold the control interval that contains the record until you take a syncpoint or your task ends.
  • To prevent deadlock situations, follow two rules:-(1)update files in alphabetical order and (2) update records in ascending key sequence.
  • You can delete a record directly or subsequent to a READ with the UPDATE option.
  • You can get an exception of NOTFND if you do a DELETE with RIDFLD and the specified record does not exist. You can also get a DUPKEY if deleting via a path and duplicate alternate keys are permitted and exist.


Computers TopOfBlogs Technology Blogs Mainframe interview question and answers,mainframe jobs,cobol,vsam,jcl,cics,db2,rdbms,mvs,tso,ispf,ibm,hcl,tcs,cts,wibro Blog Directory