RXS_Catch()
This subprocedure can be used to catch an error thrown by RXS_Throw() or via other methods. The error information is retrieved into a RXS_CatchThrowErrorDS_t data structure.
Typical usage involves this subprocedure being called inside the ON-ERROR section of a MONITOR group.
Subprocedure Prototype
|
Example Code
**FREE
// This example demonstrates calling RXS_Catch() within an ON-ERROR block
// to catch an error message.
Ctl-Opt ActGrp(*New) BndDir('RXSBND');
/COPY QRPGLECPY,RXSCB
Dcl-Ds ErrorDS LikeDS(RXS_CatchThrowErrorDS_t);
Dcl-S NumA Int(10);
Dcl-S NumB Int(10);
Dcl-S Result Int(10);
monitor;
// To ensure we trigger an error, we're going to divide by 0.
NumA = 5;
NumB = 0;
Result = NumA / NumB;
on-error;
// Note that you don't have to use RXS_ResetDS to initialize ErrorDS before
// using it - this is one of the few RXS data structures where
// this is safe and correct.
ErrorDS = RXS_Catch();
// At this point ErrorDS should contain the error information for an
// MCH1211 "divide by zero" error.
endmon;
return;
Data Structures
|
|
|
The message ID that was received. |
|
The message file used to store the message ID. |
|
The message data to be merged with the text of the message ID. |
|
Internal use only |
|
The type of message that was sent. Valid Values:
|
|
The full message text that combines the value of the message ID's text and the merged message data. |
|
Not used. Used by RXS_Throw() only. Valid Values:
Default Value: |