Anda di halaman 1dari 2

EDI File Format

The format of an EDI file can be described as follows: [RecordType] (delimiter or fixed length padding) RecordCounter | data. For example: given a file format of pipe delimited with trimmed spaces and a simple HDR/DTL record type HDR|6|||| DTL|1|ABC|xyz|123|1 DTL|13|ABC|animal|334|1 DTL|11|ABC|sfdk|432|2 DTL|12|ABC|wewdc|3|1 DTL|14|ABC|qwdx|416|4 Where: The first header (HDR) line contains a "checksum" record counter that is used to verify the total number of lines in the file. This count includes the HDR line itself. Each detail line contains the record type (DTL) followed by the data values. The column containing "ABC" would be the dealer key for ABC Company SLIK will create the header line and calculate the line count if no column mapping is specified for the "first" record (i.e., a record type having precedence equal to zero) in the EDI Mapping table. Otherwise the user can define the columns (using EDI Column Mapping) that make up the "header" record and declare one of the columns to be used as a record counter. SLIK can support an unlimited number of record types that may include sub-detail type lines. SLIK EDI also supports a variable number of columns between the various record types.

Validation of Record Count


In addition to calculating the record count when exporting data SLIK also performs validation of the record count when importing data. If a mismatch is detected an error is raised and any data inserted into the database table is rolled-back (subject to database transaction support).

EDI File Naming Convention


SLIK follows a simple file naming convention based on the concatenation of "[File Type][Sequence].[Extension]", e.g., PON394.FTC. When SLIK creates an output file (i.e., export) it assigns a dealer/filetype unique sequence number as part of the file name. When processing an import operation the Import Directory specified is first searched for any files matching the File Type pattern (e.g., PON*.*). The sequence number orders any matching files found. You can override this file name convention using the ImportFileSpec column. Note: the FileType pattern can match files from different dealers. As noted above the dealer code is determined by inspecting the file extension. For each file SLIK imports and exports it keeps track of the last import/export sequence number used for a particular dealer code and file type. During an EDI import if the next sequence number is out of sync a warning message is generated, although the processing will continue. Note: this functionality can be switched on or off using the job processing options.

How EDI Functions are Implemented


When SLIK processes an export operation the rows are retrieved from the database one at a time and are appended to a collection of logical memory files. These memory files are not written to disk until all the rows for all the record types are processed. Based on the dealer key and control break columns the internal logical memory files are retrieved or created before appending the data. When SLIK writes the files to disk it first writes any header with the calculated record counter value followed by the data held in the memory file. By performing all of its processing in memory files SLIK can group data into nested record types and if required write these to either a single file or write them to multiple physical files. When an import operation is conducted the file is first read into a memory file and validated before performing any database insert actions.

Overwrite Save File


An Overwrite Save File checkbox is provided on the EDI Transfer form. When enabled SLIK will overwrite old import files found with the same name in the save directory when moving processed files. If the Overwrite Save File function is not enabled SLIK checks for a duplicate file before processing. Note: the Save directory can be explicitly specified in the EDI Transfer form. If not specified SLIK defaults to the ImportDirectory\Save directory

Check Previous Hours


In the EDI File Type form an optional numeric field called Check Previous Hours is available. If specified SLIK will check for the existence of the current import file sequence number in the EDI Transfer Log to determine if it has been previously processed within a specified number of hours. If a value meeting the criteria set in the Check Previous Hours field is found SLIK flags the file with a warning (i.e., Operator Alert) and does not re-process the file. The file is subsequently moved to the Save directory with the current date and time appended to the file name. Note: specifying a CheckPrevHours value of zero causes SLIK to check the entire EDI Transfer log for the current file sequence number.

Optional Line Counter


SLIK can validate that the number of lines in a file corresponds to the number of lines noted in the file header. This is done by checking the Counter Column checkbox in the EDI Column Mapping form. If the Counter Column checkbox is not enabled in the EDI Column Mapping form, then the line counting validation is not performed.

User Definable Import File Specification


The Definable Import File Specification feature allows you to override the default file naming convention when processing import files. This is done using the Import File Spec field located on the EDI File Type form. The format of the specification is as follows. Specification Evaluates to %T File Type %S Sequence No <integer> %D Dealer Code %# Numeric wildcard Any other characters in the specification string are treated literally. Note: if the Import File Spec is not specified then the default import file specification is %T%S.%D.