SetErrorCode
The SetErrorCode function adds an error code to 1 of two accumulating sets. The two data fields used to return error codes to a client application such as Gateway are ibmValResults and ibmNprValidationResults. SetErrorCode automatically adds the error code to the appropriate results data field.
- The item record, which is record type 6.
- Zero or more addenda records, which are record type 7.
The ibmNprValidationResults data field is used to associate error codes with the message. For an ACH transaction, the error code is associated with the transaction itself, regardless of which record caused the error code.
The first parameter of SetErrorCode is the error code. The second, optional parameter is the addenda number of the addenda record with the error. When multiple addenda records have the same addenda number, the error code is assigned to the first addenda record in the set. You can use collectors to apply to the error code to the specific record.
The return value indicates whether the operation was successful. The operation fails if the error code is unknown. Using the return value is optional.
Return type
The function return type is: BOOLEAN
Function parameters
| Parameter order | Input variable type | Parameter data type | Required parameter | Description |
|---|---|---|---|---|
| 1 | Valid types are:
|
STRING | Yes | The error code. |
| 2 | Constant | STRING | No | The addenda number. |
Example
<taskDescriptor name="TaskName" type="ASSIGNMENT">
<assignments>
<assignment field="" type="SetErrorCode" value="'EC101'" conditions="errorDectected EQ 'Y'/>
<assignment field="" type="SetErrorCode" value="'EC102', '13'" conditions="errorDectected EQ 'Y'"/>
<assignment field="success" type="SetErrorCode" value="'EC103'" conditions="errorDectected EQ 'Y'"/>
</assignments>
</taskDescriptor>
- The first assignment statement calls SetErrorCode to add error code EC101 to ibmNprValidationResults.
- The second assignment statement calls SetErrorCode to add error code EC102 to ibmValResults and to associate it with addenda record 13.
- The third assignment statement calls SetErrorCode to add error code EC103 to ibmNprValidationResults and to set the success data field to either Y or N.