Discard
In the context of mainframe systems, "discard" refers to the intentional act of ignoring, deleting, or releasing data, messages, or resources that are no longer needed, are invalid, or have served their purpose. This action is crucial for efficient resource management, error handling, and controlling data flow within applications like CICS, IBM MQ, or batch jobs.
Key Characteristics
-
- Intentional Action: Discarding is a deliberate programmatic or operational decision, not an accidental loss of data.
- Resource Management: It often aims to free up system resources (memory, disk space, queue entries) occupied by transient or obsolete data.
- Context-Dependent: The mechanism and implications of discarding vary significantly based on the specific mainframe component (e.g., CICS, MQ, JCL utilities).
- Controlled Data Loss: While it results in data being removed, this loss is expected and managed as part of the application's logic or system design.
- Error Handling Component: Can be a strategy for dealing with corrupted, malformed, or unauthorized data by preventing its further processing.
Use Cases
-
- CICS Terminal Management: When a new screen is is sent to a terminal, the previous screen's data is implicitly or explicitly discarded (e.g., using
SEND ERASEorSEND ERASEAUPin a COBOL CICS program). - Transient Data Queues (TDQ): Records read from an intrapartition TDQ are automatically discarded after being read, or an entire queue can be cleared using CICS commands.
- IBM MQSeries: Messages that have expired, cannot be delivered, or are deemed unprocessable by an application might be discarded or moved to a dead-letter queue.
- Batch Job Filtering: JCL or utility programs (like DFSORT) can be used to discard records from an input dataset that do not meet specific criteria, preventing them from being processed further.
- Error Recovery: Discarding invalid input records or transactions to prevent them from causing further processing errors or system instability.
- CICS Terminal Management: When a new screen is is sent to a terminal, the previous screen's data is implicitly or explicitly discarded (e.g., using
Related Concepts
Discarding is closely related to resource management and error handling strategies across z/OS. In CICS, it's fundamental to screen flow and ensuring terminals display current information. For queueing mechanisms like CICS Transient Data Queues (TDQ) and IBM MQSeries, discarding is a standard operation for managing message lifecycle and queue depth. It contrasts with archiving or logging, where data is retained for future reference, audit, or recovery, and is a deliberate action distinct from an abend (abnormal end) which implies an uncontrolled termination.
- Clear Logic for Discard: Define precise conditions under which data should be discarded to prevent unintended data loss or incorrect processing.
- Logging Discarded Data: For critical applications, log details of discarded items (e.g., to a dead-letter queue, error file, or system log) for auditing, analysis, and debugging.
- Validate Before Discard: Implement robust data validation routines to ensure that only truly invalid or unnecessary data is discarded, minimizing the risk of losing valuable information.
- Resource Monitoring: Monitor queue depths and resource usage to identify scenarios where discarding might be necessary to prevent resource exhaustion or performance degradation.
- Consider Alternatives: Before permanently discarding data