RXS_Throw()
This subprocedure can be used to throw an error. The error information is populated into a data structure which is then passed to RXS_Throw. The error can be caught by RXS_Catch().
Subprocedure Prototype
|
|
|
The RXS_CatchThrowErrorDS_t data structure that contains the error information to be thrown. |
Example Code
*--------------------------------------------------------------
* This example code demonstrates throwing a diagnostic error
* by assigning values to a RXS_CatchThrowErrorDS_t datastructure and
* throwing the error datastructure to the calling program.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)
/copy QRPGLECPY,RXSCB
D gErrorDS DS Likeds(RXS_CatchThrowErrorDS_t)
D Inz(*LikeDS)
/free
// Send a diagnostic error message
RXS_ResetDS( gErrorDS : RXS_DS_TYPE_CATCHTHROWERROR );
gErrorDS.MessageId = 'CPF9898';
gErrorDS.MessageFile = 'QCPFMSG';
gErrorDS.MessageData = 'This is a *DIAG error being thrown';
gErrorDS.MessageType = RXS_MESSAGE_TYPE_DIAG;
RXS_Throw(gErrorDS);
*INLR = *ON;
/end-free
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. |
|
|
|
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. |
|
Set to RXS_YES when you want the error sent to the program that called the program which is throwing the error. By default, the program throwing the error will be the target of the error. |