Scenario - SplitFile 

Page / - last modified by Outhman Moustaghfir on 2024/08/08 12:38 

SplitFile 
last modified by Outhman Moustaghfir
on 2024/08/08 12:38

Table of Contents
SplitFile Connector Documentation
Overview
Usage
Xml Format
Key Attributes:
1. Mode: line
Input File Example :
output files :
Example 2: with specifiying include attribute
2. Mode: message:
an example of an output file

SplitFile Connector Documentation
Overview

The splitFile connector is a utility designed to split files based on specific configurations defined in an XML format. The connector supports two modes of operation: line and message mode. Below is the functional documentation for each mode, including the expected format file, sample input file, and corresponding output files.
Usage
Xml Format

<ixDOC xmlns:ixf="http://www.ixPath.com/Function"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:ix="localFunction"
      xmlns:fn="http://www.w3.org/2005/xpath-functions">

 <SplitBy mode="" headers="" footers="" excluded="" included="" endLine="" position ="" size="" optionChar="" ></SplitBy>
</ixDOC>
Key Attributes:
•	Headers and Footers: Specify header and footer lines to be included in each output file.
•	endLine: Define the character used to separate lines in the file, default value is newLine char.
•	optionChar : Define the character used to separate lines in output file, default value is newLine char.
•	included : Include specific lines from the output by defining them in the include attribute.
•	excluded: Exclude specific lines from the output by defining them in the exclude attribute.
•	Position and Size: Used  to locate and define the include in the input file.
1. Mode: line
Input File Example :
UNA +.? '
UNB+UNOD 3+5907613200009 14+5907808850002 14+240509 1553+11480134402++DESADV'
UNH+22865910+DESADV D 96A UN EAN005'
BGM+351+5103742405090001+9'
DTM+137 20240509 102'
DTM+2 20240509 102'
DTM+17 20240509 102'
RFF+DQ 5103742405090001'
DTM+171 20240509 102'
RFF+ON 0136811328'
NAD+BY+5907808850002  9++CASTORAMA POLSKA SP.  Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
NAD+SU+5907613200009  9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
NAD+DP+5908305680970  9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
NAD+FW+5907613200009  9'
CPS+1'
LIN+1++5907640254112 EN'
PIA+1+S1OVZ.075.201.126.522_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00001'
RFF+ON 0136811328'
LIN+2++5907640254150 EN'
PIA+1+S1OVZ.075.201.106.511_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00002'
RFF+ON 0136811328'
LIN+3++5907640254426 EN'
PIA+1+S2OVZ.075.264.126.524_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00003'
RFF+ON 0136811328'
LIN+4++5907640254617 EN'
PIA+1+S1OVZ.075.230.126.523_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00004'
RFF+ON 0136811328'
LIN+5++5907640254624 EN'
PIA+1+S1OVZ.075.201.106.511_USNE SA'
QTY+12 1.00 EA'
QTY+52 1 EA'
RFF+LI 00005'
RFF+ON 0136811328'
CNT+2 5'
UNH+22865910+DESADV D 96A UN EAN005'
BGM+351+5103742405090001+9'
DTM+137 20240509 102'
DTM+2 20240509 102'
DTM+17 20240509 102'
RFF+DQ 5103742405090001'
DTM+171 20240509 102'
RFF+ON 0136811328
NAD+BY+5907808850002  9++CASTORAMA POLSKA SP.  Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
NAD+SU+5907613200009  9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
NAD+DP+5908305680970  9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
NAD+FW+5907613200009  9'
CPS+1'
LIN+1++5907640254112 EN'
PIA+1+S1OVZ.075.201.126.522_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00001'
RFF+ON 0136811328'
LIN+2++5907640254150 EN'
PIA+1+S1OVZ.075.201.106.511_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00002'
RFF+ON 0136811328'
LIN+3++5907640254426 EN'
PIA+1+S2OVZ.075.264.126.524_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00003'
RFF+ON 0136811328'
LIN+4++5907640254617 EN'
PIA+1+S1OVZ.075.230.126.523_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00004'
RFF+ON 0136811328'
LIN+5++5907640254624 EN'
PIA+1+S1OVZ.075.201.106.511_USNE SA'
QTY+12 1.00 EA'
QTY+52 1 EA'
RFF+LI 00005'
RFF+ON 0136811328'
CNT+2 5'
UNH+22865910+DESADV D 96A UN EAN005'
BGM+351+5103742405090001+9'
DTM+137 20240509 102'
DTM+2 20240509 102'
DTM+17 20240509 102'
RFF+DQ 5103742405090001'
DTM+171 20240509 102'
RFF+ON 0136811328'
NAD+BY+5907808850002  9++CASTORAMA POLSKA SP.  Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
NAD+SU+5907613200009  9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
NAD+DP+5908305680970  9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
NAD+FW+5907613200009  9'
CPS+1'
LIN+1++5907640254112 EN'
PIA+1+S1OVZ.075.201.126.522_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00001'
RFF+ON 0136811328'
LIN+2++5907640254150 EN'
PIA+1+S1OVZ.075.201.106.511_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00002'
RFF+ON 0136811328'
LIN+3++5907640254426 EN'
PIA+1+S2OVZ.075.264.126.524_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00003'
RFF+ON 0136811328'
LIN+4++5907640254617 EN'
PIA+1+S1OVZ.075.230.126.523_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00004'
RFF+ON 0136811328'
LIN+5++5907640254624 EN'
PIA+1+S1OVZ.075.201.106.511_USNE SA'
QTY+12 1.00 EA'
QTY+52 1 EA'
RFF+LI 00005'
RFF+ON 0136811328'
CNT+2 5'
UNH+22865910+DESADV D 96A UN EAN005'
BGM+351+5103742405090001+9'
DTM+137 20240509 102'
DTM+2 20240509 102'
DTM+17 20240509 102'
RFF+DQ 5103742405090001'
DTM+171 20240509 102'
RFF+ON 0136811328'
NAD+BY+5907808850002  9++CASTORAMA POLSKA SP.  Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
NAD+SU+5907613200009  9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
NAD+DP+5908305680970  9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
NAD+FW+5907613200009  9'
CPS+1'
LIN+1++5907640254112 EN'
PIA+1+S1OVZ.075.201.126.522_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00001'
RFF+ON 0136811328'
LIN+2++5907640254150 EN'
PIA+1+S1OVZ.075.201.106.511_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00002'
RFF+ON 0136811328'
LIN+3++5907640254426 EN'
PIA+1+S2OVZ.075.264.126.524_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00003'
RFF+ON 0136811328'
LIN+4++5907640254617 EN'
PIA+1+S1OVZ.075.230.126.523_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00004'
RFF+ON 0136811328'
LIN+5++5907640254624 EN'
PIA+1+S1OVZ.075.201.106.511_USNE SA'
QTY+12 1.00 EA'
QTY+52 1 EA'
RFF+LI 00005'
RFF+ON 0136811328'
CNT+2 5'
UNH+22865910+DESADV D 96A UN EAN005'
BGM+351+5103742405090001+9'
DTM+137 20240509 102'
DTM+2 20240509 102'
DTM+17 20240509 102'
RFF+DQ 5103742405090001'
DTM+171 20240509 102'
RFF+ON 0136811328'
NAD+BY+5907808850002  9++CASTORAMA POLSKA SP.  Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
NAD+SU+5907613200009  9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
NAD+DP+5908305680970  9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
NAD+FW+5907613200009  9'
CPS+1'
LIN+1++5907640254112 EN'
PIA+1+S1OVZ.075.201.126.522_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00001'
RFF+ON 0136811328'
LIN+2++5907640254150 EN'
PIA+1+S1OVZ.075.201.106.511_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00002'
RFF+ON 0136811328'
LIN+3++5907640254426 EN'
PIA+1+S2OVZ.075.264.126.524_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00003'
RFF+ON 0136811328'
LIN+4++5907640254617 EN'
PIA+1+S1OVZ.075.230.126.523_M SA'
QTY+12 2.00 EA'
QTY+52 1 EA'
RFF+LI 00004'
RFF+ON 0136811328'
LIN+5++5907640254624 EN'
PIA+1+S1OVZ.075.201.106.511_USNE SA'
QTY+12 1.00 EA'
QTY+52 1 EA'
RFF+LI 00005'
RFF+ON 0136811328'
CNT+2 5'
UNZ+1+11480134402'
UNZ1'
'
Example 1: without specifying include attribute
when we don't use include attribute. it means for each output file we are going to have headers and footers and also for the include we will defined them by position and size so for each line at a specific position and with a size this is the include .

<ixDOC xmlns:ixf="http://www.ixPath.com/Function"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:ix="localFunction"
      xmlns:fn="http://www.w3.org/2005/xpath-functions">

 <SplitBy mode="line" headers="UNA;UNB" footers="UNZ1;UNZ" excluded="QTY" include ="" endLine="'" position ="25" size="9"></SplitBy>
</ixDOC>
output files :

fileName_1_ UN EAN00.txt
UNA +.? '
UNB+UNOD 3+5907613200009 14+5907808850002 14+240509 1553+11480134402++DESADV'
UNH+22865910+DESADV D 96A UN EAN005'
UNH+22865910+DESADV D 96A UN EAN005'
UNH+22865910+DESADV D 96A UN EAN005'
UNH+22865910+DESADV D 96A UN EAN005'
UNH+22865910+DESADV D 96A UN EAN005'
UNZ+1+11480134402'
UNZ1'
Example 2: with specifiying include attribute
we don't need to use position and size.
2. Mode: message:
In message mode, the file is split into sections based on a specified include . Each output file begins with the start of an include and ends when another include is encountered.
Example

<ixDOC xmlns:ixf="http://www.ixPath.com/Function"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:ix="localFunction"
      xmlns:fn="http://www.w3.org/2005/xpath-functions">

 <SplitBy mode="message" headers="UNA;UNB" footers="UNZ1;UNZ" excluded="QTY" include ="UNH" endLine="'"></SplitBy>
</ixDOC>
an example of an output file
UNA +.? '
UNB+UNOD 3+5907613200009 14+5907808850002 14+240509 1553+11480134402++DESADV'
UNH+22865910+DESADV D 96A UN EAN005'
BGM+351+5103742405090001+9'
DTM+137 20240509 102'
DTM+2 20240509 102'
DTM+17 20240509 102'
RFF+DQ 5103742405090001'
DTM+171 20240509 102'
RFF+ON 0136811328'
NAD+BY+5907808850002  9++CASTORAMA POLSKA SP.  Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
NAD+SU+5907613200009  9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
NAD+DP+5908305680970  9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
NAD+FW+5907613200009  9'
CPS+1'
LIN+1++5907640254112 EN'
PIA+1+S1OVZ.075.201.126.522_M SA'
RFF+LI 00001'
RFF+ON 0136811328'
LIN+2++5907640254150 EN'
PIA+1+S1OVZ.075.201.106.511_M SA'
RFF+LI 00002'
RFF+ON 0136811328'
LIN+3++5907640254426 EN'
PIA+1+S2OVZ.075.264.126.524_M SA'
RFF+LI 00003'
RFF+ON 0136811328'
LIN+4++5907640254617 EN'
PIA+1+S1OVZ.075.230.126.523_M SA'
RFF+LI 00004'
RFF+ON 0136811328'
LIN+5++5907640254624 EN'
PIA+1+S1OVZ.075.201.106.511_USNE SA'
RFF+LI 00005'
RFF+ON 0136811328'
CNT+2 5'
UNZ+1+11480134402'
UNZ1'
Other Examples :
<!-- Write a file for each type of segment -->
<SplitBy mode="line" headers="UNA;UNB" footers="UNZ" excluded="UNA;UNB;UNZ" included="" size="3" position="1" endLine="'" optionChar="\r\n" ></SplitBy>

<!-- Write a file for each type of record where the line identifier (Position 1 to 8) is different -->
<SplitBy mode="line" size="8" position="1" ></SplitBy> <!-- The default endLine is the carriage return -->

<!-- Write a file for each message starting with UNH with repeated envelope for each -->
<SplitBy mode="message" headers="UNA;UNB" footers="UNZ" excluded="" included="" size="3" position="1" endLine="'" optionChar="\r\n" ></SplitBy>