cerror
The cerror function raises a compliance error and reports the target statement (the statement you specify) on the translation report. You typically specify this function as a action to be performed if a condition is false.
This function is valid on the input side of a map only. There is also an optional third parameter you can supply: a string that is written to the translator report as part of the entry for the compliance error.
The cerror function can also be used with SWIFTNet to allow it to be called with only a code and description string (instead of code, field reference, option description string).
| If the map/form is of type ... | Then the cerror function is ... |
|---|---|
| Screen entry | Not valid. |
| Not valid. | |
| Export | Only valid on the input side of the map. |
| Import | Valid on the input or output side of the map. |
| Break (Interchange, Group, or Transaction Set) | Only valid on the input side of the map. |
| Build (Interchange, Group, or Transaction Set) | Not valid. |
Common use
In addition to creating errors for user controlled validation, the cerror function is also used during debugging. The ability to pass a string to the cerror function allows you to use the cerror function the same way you would use a messagebox, with the results being written to the translator report instead.
Syntax
The cerror function can be specified in two ways.
Syntax 1
cerror(error_number,$GROUP_NAME[index][index][index].#FIELD_NAME,
"Optional string with error information can be supplied here");Syntax 2
cerror(code, "String with error information supplied here");Examples
Syntax 1
cerror(100,$GROUPNAME[0][1][1].#FIELDNAME);
//This raises compliance error 100 on the FIELDNAME field of the
//specified instance of the GROUPNAME group. There is no optional error text
//given.Syntax 2
cerror(100, "Number not valid");
//This raises compliance error 100 with error text "Number not valid" in the
//translator report. Compliance codes
| Message Number | Message Type | Messages Generated |
|---|---|---|
| 12 | Information | Start time |
| 13 | Information | End time |
| 14 | Information | Blocks read |
| 15 | Information | Blocks written |
| 19 | Information | Execution time in milliseconds |
| 20 | Information | Translation object name |
| 21 | Information | Translation is lightweight |
| 25 | Warning | Block data unknown |
| 100 | Error | Mandatory data missing |
| 101 | Error | Insufficient repeats |
| 102 | Error | Too many repeats |
| 110 | Error | Incorrect data format |
| 111 | Error | Data not minimum length |
| 112 | Error | Data exceeds maximum length |
| 113 | Error | Invalid date |
| 120 | Error | Too many components |
| 121 | Error | Too many composite elements |
| 122 | Error | Unsupported data type |
| 123 | Error | Data conversion error |
| 140 | Error | Standard rule failure |
| 142 | Error | Standard rule: use code data missing |
| 143 | Error | Standard rule: data conversion error |
| 170 | Error | Extended rule failure |
| 171 | Error | Extended rule data conversion error |
| 300 | Error | Mandatory block missing |
| 301 | Error | Mandatory group missing |
| 316 | Error | Maximum usage exceeded |
| 400 | Error | Block processor initialization failure |
| 401 | Error | Field processor initialization failure |
| 10001 | Information | Block signature |
| 10002 | Information | Block count Note: This message will only be written
if you create the cerror extended rule at the field level. If you
call the cerror extended rule at any other level in your map, it will
not be written because it is only applicable at the field level.
|
| 10003 | Information | Block name Note: This message will only be written
if you create the cerror extended rule at the field level. If you
call the cerror extended rule at any other level in your map, it will
not be written because it is only applicable at the field level.
|
| 10004 | Information | Field name Note: This message will only be written
if you create the cerror extended rule at the field level. If you
call the cerror extended rule at any other level in your map, it will
not be written because it is only applicable at the field level.
|
| 10005 | Information | Field data |
| 10006 | Information | Exception |
| 10007 | Information | Group name |
| 10008 | Information | Field ID |
| 10009 | Information | Field number |
| 10010 | Information | Instance |
| 10011 | Information | Rule type |
| 10012 | Information | On begin rule |
| 10013 | Information | On end rule |
| 10014 | Information | Repeat count |
| 10015 | Information | Block data |
| 10016 | Information | Block signature ID tag Note: This message will
only be written if you create the cerror extended rule at the field
level. If you call the cerror extended rule at any other level in
your map, it will not be written because it is only applicable at
the field level.
|
| 10017 | Information | Map iteration count Note: This message will only
be written if you create the cerror extended rule at the field level.
If you call the cerror extended rule at any other level in your map,
it will not be written because it is only applicable at the field
level.
|
| 10018 | Information | Additional information |
| Message Number | Message Type | Messages Generated |
|---|---|---|
| 700 | Error | SQL data source open error |
| 701 | Error | SQL data source rollback |
| 702 | Error | SQL data source commit error |
| 703 | Error | SQL data source rollback error |
| 710 | Error | SQL query open error |
| 711 | Error | SQL command error |
| 712 | Error | SQL cursor error |
| 713 | Error | SQL get field error |
| 721 | Error | SQL output operation error |
| 722 | Error | SQL prepared statement error |
| 724 | Information | SQL update effected 0 rows |
| 725 | Information | SQL retrying as insert |
| 726 | Information | SQL retrying as update |
| 10700 | Information | Data source name |
| 10701 | Information | Data source pool |
| 10702 | Information | Query name |
| 10703 | Information | SQL statement |
| 10704 | Information | Cursor operation |
| 10705 | Information | Column ID |
| Message Number | Message Type | Message Generated |
|---|---|---|
| 103 | Information | Illegal repeating delimiter |
| 104 | Information | Illegal subelement delimiter |
| 105 | Information | Element position |
| 106 | Information | Subelement position |
| Message Number | Message Type | Message Generated |
|---|---|---|
| 610 | Error | XML particle or group error |
| 690 | Error | XML parser error |
| 691 | Error | XML element unknown |
| 692 | Error | XML pcdata unknown |
| 693 | Error | XML attribute unknown |
| 10060 | Information | Public ID |
| 10061 | Information | System ID |
| 10062 | Information | Line number |
| 10063 | Information | Column number |
| 10064 | Information | Message |
| 10065 | Information | XML tag name |
| 10066 | Information | XML namespace URI |