DELETE


Delete a record from a file - VSAM KSDS and VSAM RRDS only. The DELETE command deletes a record from a file on a KSDS or a path over a KSDS or an RRDS. Record can't be deleted from a VSAM ESDS or a BDAM file. The file can be on a local or a remote system. RIDFLD option contains the information of specific record to be deleted.

Group of records can be deleted by using the GENERIC option with generic key and the option is available to KSDS only. The generic key specified will match a very large number of records, then the CICS unit of work will be holding a very large number of record locks until sync point.

This might cause storage issues within the CICS region or if the file is an RLS file, it could affect other systems as well. It is advisable to code SYNCPOINT immediately after a generic DELETE to avoid the above scenario. DELETE command can use to delete a single record that has previously been retrieved for update. But must not specify the RIDFLD option.

Syntax -


DELETE Syntax

Parameters -


FILE(file-name) -

Specifies the file name to be accessed. If SYSID is specified, the data set is on a remote system irrespective of the name is defined to CICS. If SYSID is not specified, the data set assumed to be on the local system. Otherwise, the resource definition is used to find out whether the data set is on a local or a remote system.

KEYLENGTH(data-value) -

data-value is a halfword binary value. Specifies the key length. The value specified in KEYLENGTH is same as the value specified in the RIDFLD option except when RBA or RRN is specified.

KEYLENGTH is not valid when RBA or RRN is specified. KEYLENGTH must be specified if GENERIC is specified or key is specified. If the length specified is different from the length defined for the data set and the operation is not generic, the INVREQ condition occurs.

The INVREQ condition also occurs if GENERIC specified and the KEYLENGTH is not less than the length specified in the VSAM definition. For remote files, specify the KEYLENGTH in the FILE definition. If KEYLENGTH is not defined and is not specified in the application program and the key is longer than 4 characters, the default value is 4.

NOSUSPEND -

Specifies that the request is not to wait if VSAM is holding an active lock against the record.

RBA -

This option is for VSAM KSDS base data sets only. Specifies the RIDFLD option field contains a relative byte address.

RIDFLD(data-area) -

Specifies the record identification field. The contents can be a key or a relative byte address (RBA) or a relative record number. The field is full word binary for a relative byte address or a relative record number. If RBA is specified, the RIDFLD can be greater than or equal to zero. If RRN is specified, the RIDFLD can be greater than or equal to 1. RIDFLD should specify if the GENERIC option specified.

TOKEN(data-area) -

data-value is a fullword binary value. Specifies a unique request identifier for a DELETE request.

NUMREC(data-value) -

This option is valid for VSAM KSDS only. data-value is a halfword binary value. Specifies that CICS sets to the number of deleted records.

GENERIC -

This option is valid for VSAM KSDS only. Specifies the search key is a generic key with a length specified in the KEYLENGTH option.

RRN -

This option is valid for VSAM RRDS. Specifies the RIDFLD option contains a relative record number.

SYSID(system-name) -

Specifies the system name to which the request is directed. If SYSID specified and omit RBA and RRN, KEYLENGTH must be specified.

Error Conditions -


Below are the list of error conditions may occur in combination. If more than one occurs, only the first is passed to the application program.

Error ConditionRESP2, Description & SolutionSystem Action
84 DISABLED
50 - A file is disabled.Solution: – Check the file status and enable the file using SET FILE or CEMT SET FILE
Note! This condition cannot occur when the DELETE command follows any read with the UPDATE option.
Task abnormally terminated
15 DUPKEY
140 - A record is accessed by way of an alternate index with the NONUNIQUEKEY attribute and another alternate index record with the same key follows.
Solution -Verify the record key and use READ with UPDATE to delete specific record or use generic key to delete both if the second record is not important.
Task abnormally terminated
12 FILENOTFOUND
1 - A file name in the FILE option is not defined to CICS.
Solution -Contact support team to define the FILE in CICS region.
Task abnormally terminated
21 ILLOGIC
110 - VSAM error occurs that is not in one of the other CICS response categories.
Solution -This might be due to the non-sequence of file operations. Debug the program to correct the logic.
Task abnormally terminated
16 INVREQ
20 - Delete operations are not allowed according to the resource definition.
Solution -Change the resource definitions if the deletion is valid or do not perform delete if the file definitions are correct.

21 - Command is issued for a file referring to a VSAM ESDS.
Solution -You can’t delete the record from a VSAM ESDS. Change the program to remove the delete command.

22 - A GENERIC DELETE is issued for a file that is not a VSAM KSDS.
Solution -GENERIC option applicable to VSAM KSDS only. Change the program to remove the delete command.

25 - The KEYLENGTH and GENERIC options specified and the length value in the KEYLENGTH option is greater than or equal to the length of a full key.
Solution -When a KEYLENGTH and GENERIC options specified, it is a generic key and the length value should be less than the length of the full key. Change the program to modify the length value.

26 - The KEYLENGTH option is specified and the length does not equal the length defined for the data set.
Solution -If only KEYLENGTH option specified, the length value should match the dataset full key. Change the program to modify the length value.

27 - Command is issued for a file referring to a BDAM data set.
Solution -You can’t delete the record from a BDAM dataset. Change the program to remove the delete command.

31 - Command without the RIDFLD option is issued for a file where no previous READ UPDATE command has been issued.
Solution -The record should be locked first to delete it from file and RIDFLD plays important role in it. Change the program to make sure the READ UPDATE should be preceded before DELETE command.

42 - The KEYLENGTH and GENERIC options are specified, and the length in the KEYLENGTH option is less than zero.
Solution -When a KEYLENGTH and GENERIC options specified, it is a generic key and the length value should be less than the length of the full key and should be greater than zero. Change the program to modify the length value.

47 - Command includes a token whose value can’t be matched against any token in use for an existing READ with UPDATE request.
Solution -DELETE command token value should be matched with READ UPDATE token value. Change the program to modify the token value.

51 - Command specifying the RBA or XRBA keyword is issued against a KSDS file that is being accessed in RLS mode.
Solution -RBA or XRBA option is not valid for KSDS file accessing in RLS mode. Modify the program to remove RBA option for files which are accessing in RLS mode.

55 - NOSUSPEND is specified for a non-RLS file.
Solution -NOSUSPEND option is valid for only VSAM files accessed in RLS mode. Modify the program to remove NOSUSPEND option for files which are not accessing in RLS mode.

59 - XRBA was specified, but the data set is not an extended ESDS.
Solution -XBRA only for extended ESDS. Modify the program to remove XBRA option for writing the files other than extended ESDS.
Task abnormally terminated
17 IOERR
120 - There is an I/O error during the file control operation.
Solution -An I/O error is any unusual event that is not covered by a CICS condition. For VSAM files, IOERR usually indicates a hardware error.
Task abnormally terminated
54 ISCINVREQ
70 - The remote system indicates a failure that does not correspond to a known condition.
Solution -Contact remote system support team to resolve the issue.
Task abnormally terminated
100 LOCKED
An attempt has been made to delete a record, but lock exists against the key.
Solution -The record might get locked for some other reason. Wait for some time and try again.
abend the task with code AEX8.
70 NOTAUTH
101 - A resource security check has failed on FILE (filename).
Solution -Contact system administrator team to check whether the appropriate access added for the user or group. It will resolve the problem.
Task abnormally terminated
19 NOTOPEN
60 - Below are the reasons for NOTOPEN
  • The requested file is CLOSED and UNENABLED.
    Solution -Open and enable the file using SET FILE or a CEMT SET FILE command. If no access, contact support team to enable the file.
  • The requested file is OPEN and in use by other transactions, but a CLOSE request against the file has been received.
    Solution -The CLOSE request might for using the file in batch environment. Wait for some time and try again later once the file enabled.
  • The requested file is CLOSED and ENABLED, so CICS has tried to open the file as part of executing the request.
    Solution -Open the file using SET FILE or a CEMT SET FILE command. If no access, contact support team to open the file.
Task abnormally terminated
101 RECORDBUSY
107 - The NOSUSPEND keyword is specified for the deletion of a record that is locked by a VSAM active lock.
Solution -This might occur very rarely. Wait for some time and try again.If this occurring on regular basis, modify the application program to remove NOSUSPEND.
Abend the task with code AEX9
53 SYSIDERR
130 - The SYSID name specified is neither the local region nor a remote system or the link to the remote system is closed.
Solution -The specified SYSID name is not related to any system. Correct it.If the link to the remote system is closed, that might be due to the remote system is not up and running. Contact remote system support team.
Task abnormally terminated
13 NOTFND
80 - An attempt to delete a record based on the search argument provided is unsuccessful.
Solution -This might occur due to the record already gets deleted or the record doesn’t exist. Handle the error programmatically.
Task abnormally terminated