When you run a mapping that reads data from or writes data to a TRADACOMS structure, MapForce performs structural data validation checks according to the TRADACOMS specification, and displays any validation errors in the Messages window.
Messages window with validation errors
As shown in the sample above, the validation messages specific to TRADACOMS (information, warnings, and errors) are displayed in addition to the generic validation messages common to any MapForce mapping. For more information about MapForce validation in general, see Validating Mappings.
The following factors determine how MapForce validates the parsed or generated TRADACOMS files:
|•||The validation constraints defined in the configuration files available in the MapForce installation folder (subfolder MapForceEDI\TRADACOMS). These configuration files supply, on one hand, the default validation rules of the TRADACOMS specification. On the other hand, they provide the means to adapt the TRADACOMS format to custom requirements. In particular, it is possible to modify the data elements, segments, or code values defined in the configuration files, and thus influence both the outcome of validation and the mapping execution. For more information about the configuration files, see Configuration Files.|
|•||The validation logic built into MapForce. This includes MapForce internal data integrity checks that may not be enforced by means of configuration files.|
|•||Any custom validation settings that you have defined from the MapForce graphical user interface (see EDI component validation ). To view or change the current EDI validation settings of any EDI component, including TRADACOMS, double-click the header of the component, and then click Validation on the Component Settings dialog box.|
When writing to a TRADACOMS structure, MapForce automatically fills in the contents of those data elements for which the value can be calculated or is predefined. This is referred to as "automatic completion" (or "auto-completion"). To disable this behavior, clear the Auto-complete missing fields check box from the Component Settings dialog box (see EDI Component Settings ).
The following TRADACOMS validation rules cause MapForce to either raise validation errors (during file parsing or generation) or to auto-complete missing fields (during file generation):
|1.||The segments STX (Start of Transmission) and END (End of Transmission) must exist.|
|2.||If STDS-1 has the value 'ANAA' then a Reconciliation Message (RSGRSG) must exist before the end of transmission (END). Otherwise, no Reconciliation Message (RSGRSG) must be present.|
|3.||If STDS-1 has the value 'ANAA' then:|
|a.||The value of RSGA in the Reconciliation Message must be equal to the value of SNRF in the STX segment|
|b.||The value of RSGB in the Reconciliation Message must be equal to the value of UNTO-1 in the STX segment.|
|4.||TRDT-1 must contain the date (YYMMDD) and TRDT-2 must contain the time (HHMMSS) of transmission (current date and time).|
|5.||If the Batch Header (BAT) is present then the Batch Trailer (EOB) must also be present, and the number of messages in the batch must be available in the NOLI (Number of Messages in Batch) data element.|
|6.||The MSRF (Message Reference) data element in the Message Header (MHD) must contain the consecutive count of messages within the transmission, starting with 1.|
|7.||The NOSG (Number of Segments in Message) data element in the Message Trailer (MTR) must contain the number of segments, including MHD and MTR.|
|8.||When present, the Reconciliation Message (RSGRSG) must consist of one segment (RSG), except the Message Header and the Message Trailer.|
|9.||The NMST (Number of Messages in Transmission) data element in the END segment must contain the number of messages in interchange (count of MHD segments).|
|10.||In general, when reading a TRADACOMS structure, MapForce expects that the interchange environment is of type "computer to computer" (or, in TRADACOMS terminology, "intelligent terminal to intelligent terminal"). Therefore, a segment such as MHD = 12 + ORDHDR :3 would trigger a validation error, since it contains extra leading and trailing spaces.|
|11.||String data must be in upper case. When generating TRADACOMS output, MapForce converts string data to upper case.|
Additionally, as already mentioned, any validation rules defined in the configuration files will also affect TRADACOMS parsing and generation.
© 2019 Altova GmbH