CICS DOCUMENT DELETE provides document deletion capabilities in CICS environments. It enables programs to delete documents, manage document operations, and handle document deletion for cleanup and maintenance purposes.
12345EXEC CICS DOCUMENT DELETE [DOCUMENT(document-name)] [RESP(response-code)] [RESP2(response-code-2)] END-EXEC.
Specifies the name of the document to be deleted. This parameter identifies the specific document for deletion operations.
Specifies the response code variable to receive the operation result. This parameter provides error handling and status information.
Specifies the secondary response code variable for additional error information. This parameter provides extended error details when available.
DOCUMENT DELETE removes a single document from the system, freeing up storage space and removing the document from active use.
The command supports batch deletion operations for removing multiple documents efficiently in maintenance procedures.
Documents can be deleted based on specific conditions such as age, status, or business rules for automated cleanup.
Secure deletion ensures that sensitive document data is properly removed and cannot be recovered after deletion.
1234567891011121314151617WORKING-STORAGE SECTION. 01 DOCUMENT-NAME PIC X(16) VALUE 'INVOICE-001'. 01 RESPONSE-CODE PIC S9(8) COMP. 01 RESPONSE-CODE-2 PIC S9(8) COMP. PROCEDURE DIVISION. EXEC CICS DOCUMENT DELETE DOCUMENT(DOCUMENT-NAME) RESP(RESPONSE-CODE) RESP2(RESPONSE-CODE-2) END-EXEC IF RESPONSE-CODE = 0 DISPLAY 'Document deleted successfully' ELSE DISPLAY 'Error deleting document: ' RESPONSE-CODE END-IF.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546WORKING-STORAGE SECTION. 01 DOCUMENT-NAME PIC X(16). 01 RESPONSE-CODE PIC S9(8) COMP. 01 RESPONSE-CODE-2 PIC S9(8) COMP. 01 DELETE-COUNT PIC S9(8) COMP VALUE 0. PROCEDURE DIVISION. PERFORM DELETE-INVOICE-DOCUMENTS PERFORM DELETE-STATEMENT-DOCUMENTS PERFORM DELETE-REPORT-DOCUMENTS. DELETE-INVOICE-DOCUMENTS. MOVE 'INVOICE-001' TO DOCUMENT-NAME EXEC CICS DOCUMENT DELETE DOCUMENT(DOCUMENT-NAME) RESP(RESPONSE-CODE) RESP2(RESPONSE-CODE-2) END-EXEC IF RESPONSE-CODE = 0 ADD 1 TO DELETE-COUNT DISPLAY 'Invoice document deleted' END-IF. DELETE-STATEMENT-DOCUMENTS. MOVE 'STATEMENT-001' TO DOCUMENT-NAME EXEC CICS DOCUMENT DELETE DOCUMENT(DOCUMENT-NAME) RESP(RESPONSE-CODE) RESP2(RESPONSE-CODE-2) END-EXEC IF RESPONSE-CODE = 0 ADD 1 TO DELETE-COUNT DISPLAY 'Statement document deleted' END-IF. DELETE-REPORT-DOCUMENTS. MOVE 'REPORT-001' TO DOCUMENT-NAME EXEC CICS DOCUMENT DELETE DOCUMENT(DOCUMENT-NAME) RESP(RESPONSE-CODE) RESP2(RESPONSE-CODE-2) END-EXEC IF RESPONSE-CODE = 0 ADD 1 TO DELETE-COUNT DISPLAY 'Report document deleted' END-IF.
1234567891011121314151617181920212223242526272829303132333435363738394041WORKING-STORAGE SECTION. 01 DOCUMENT-NAME PIC X(16). 01 RESPONSE-CODE PIC S9(8) COMP. 01 RESPONSE-CODE-2 PIC S9(8) COMP. 01 PROCESSING-COUNT PIC S9(8) COMP VALUE 0. 01 DELETE-THRESHOLD PIC S9(8) COMP VALUE 5. PROCEDURE DIVISION. PERFORM VARYING PROCESSING-COUNT FROM 1 BY 1 UNTIL PROCESSING-COUNT > 10 PERFORM BUILD-DOCUMENT-NAME PERFORM CHECK-DELETE-CONDITION IF DELETE-REQUIRED PERFORM DELETE-DOCUMENT END-IF END-PERFORM. BUILD-DOCUMENT-NAME. STRING 'DOC-' DELIMITED BY SIZE PROCESSING-COUNT DELIMITED BY SIZE INTO DOCUMENT-NAME. CHECK-DELETE-CONDITION. IF PROCESSING-COUNT > DELETE-THRESHOLD SET DELETE-REQUIRED TO TRUE ELSE SET DELETE-NOT-REQUIRED TO TRUE END-IF. DELETE-DOCUMENT. EXEC CICS DOCUMENT DELETE DOCUMENT(DOCUMENT-NAME) RESP(RESPONSE-CODE) RESP2(RESPONSE-CODE-2) END-EXEC IF RESPONSE-CODE = 0 DISPLAY 'Document ' DOCUMENT-NAME ' deleted successfully' ELSE DISPLAY 'Error deleting document ' DOCUMENT-NAME ': ' RESPONSE-CODE END-IF.
Successful document deletion. The document has been successfully deleted from the system.
Invalid document name. The specified document name is invalid or not supported.
Document not found. The specified document does not exist in the system.
Document in use. The document is currently in use and cannot be deleted.
Deletion failed. The document deletion operation failed due to system conditions.
DOCUMENT DELETE efficiently reclaims storage space, but large document deletions may impact system performance temporarily.
Batch deletion operations should be scheduled during off-peak hours to minimize impact on active business operations.
Proper resource cleanup ensures efficient deletion operations and prevents resource leaks in the system.
Always check response codes and handle errors appropriately, especially for document existence and usage validation.
Implement proper deletion confirmation mechanisms to prevent accidental deletion of important documents.
Maintain audit trails for document deletions to track deletion history and support compliance requirements.
Ensure proper backup procedures are in place before performing bulk deletion operations to prevent data loss.
Imagine you have a toy box full of toys, and some toys are old or broken. CICS DOCUMENT DELETE is like throwing away those old toys to make room for new ones.
The document name is like the name of the toy you want to throw away. Once you throw it away, it's gone and you can't get it back, but you have more space in your toy box.
Just like you need to be careful not to throw away toys you still want to play with, the program needs to make sure it's only deleting documents that are safe to delete.
Write a program that uses DOCUMENT DELETE to remove a document with a specific name and verify the deletion was successful.
Create a program that deletes multiple documents based on specific criteria such as age or status.
Implement a document deletion system that only deletes documents when specific business conditions are met.
Understanding CICS document management and operations
Learning about CICS storage management and cleanup
Understanding CICS maintenance and cleanup procedures
Learning about CICS error handling and response codes