https://wiki.midrange.com/index.php?title=Flat_File_Parser_Configuration_Example&feed=atom&action=history
Flat File Parser Configuration Example - Revision history
2024-03-28T21:28:05Z
Revision history for this page on the wiki
MediaWiki 1.30.0
https://wiki.midrange.com/index.php?title=Flat_File_Parser_Configuration_Example&diff=11211&oldid=prev
Mihael: /* XML Configuration file */
2011-02-26T21:44:55Z
<p><span dir="auto"><span class="autocomment">XML Configuration file</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 21:44, 26 February 2011</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l94" >Line 94:</td>
<td colspan="2" class="diff-lineno">Line 94:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     <lineFormat name="end" type="const" imageString="999" /></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     <lineFormat name="end" type="const" imageString="999" /></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>      </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>      </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>     <inputProvider serviceprogram="<del class="diffchange diffchange-inline">FFPINSF</del>" procedure="<del class="diffchange diffchange-inline">ffp_input_stmf_create</del>"  </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>     <inputProvider serviceprogram="<ins class="diffchange diffchange-inline">RNGINSTMF</ins>" procedure="<ins class="diffchange diffchange-inline">rng_input_stmf_create</ins>"  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>         parameter="/home/iusr0001/src/ffp/example/xmlconfig-input.txt" /></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>         parameter="/home/iusr0001/src/ffp/example/xmlconfig-input.txt" /></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>      </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>      </div></td></tr>
</table>
Mihael
https://wiki.midrange.com/index.php?title=Flat_File_Parser_Configuration_Example&diff=11172&oldid=prev
Mihael: Created page with "== Purpose == This example shows how to move the parser configuration out of the program into a xml file for easier configuration. It is the same scenario as the validation exam..."
2011-01-30T08:35:12Z
<p>Created page with "== Purpose == This example shows how to move the parser configuration out of the program into a xml file for easier configuration. It is the same scenario as the validation exam..."</p>
<p><b>New page</b></p><div>== Purpose ==<br />
<br />
This example shows how to move the parser configuration out of the program into a xml file for easier configuration. It is the same scenario as the validation example.<br />
<br />
== Data Format ==<br />
The data format is exactly the same as in the validation example.<br />
<br />
<br />
== Line Formats ==<br />
{| border="1"<br />
! <br />
! Identifier<br />
! Data<br />
|-<br />
| Store ID <br />
| 100<br />
| 4 digits numeric<br />
|-<br />
| Date<br />
| 110<br />
| date ISO format yyyy-MM-dd<br />
|-<br />
| Item<br />
| 210<br />
| 13 alphanumeric (EAN)<br />
|-<br />
| Quantity <br />
| 220<br />
| 4 digits numeric<br />
|-<br />
| End<br />
| 999 <br />
| no extra data<br />
|}<br />
<br />
== Code ==<br />
Only the parser and a configuration provider need to be created. Everything else is done by the configuration provider.<br />
<br />
The '''whole''' program:<br />
<code><br />
/include 'ffp/parser_h.rpgle'<br />
/include 'ffp/xml_config_provider_h.rpgle'<br />
<br />
D parser S *<br />
D configProvider S *<br />
D configPath S 1000A<br />
<br />
/free<br />
configPath = '/home/iusr0001/src/ffp/example/xmlconfig.xml' + x'00';<br />
<br />
parser = ffp_create();<br />
configProvider = ffp_config_xml_create(%addr(configPath));<br />
ffp_setConfigurationProvider(parser : configProvider);<br />
ffp_loadConfiguration(parser);<br />
<br />
ffp_parse(parser);<br />
<br />
ffp_finalize(parser);<br />
<br />
*inlr = *on;<br />
/end-free<br />
</code><br />
<br />
== XML Configuration file ==<br />
<code><br />
<?xml version="1.0" ?><br />
<!DOCTYPE config SYSTEM "ffp.dtd" ><br />
<config<br />
ignoreBlankLines="yes"<br />
processInvalidLines="yes"><br />
<br />
<lineFormat name="id" type="var" imageString="100####" /><br />
<br />
<lineFormat name="date" type="var" imageString="110@@@@@@@@@@"><br />
<field length="3" /><br />
<field length="10"><br />
<validator serviceprogram="FFPVALDAT" <br />
procedure="ffp_validator_date_create" parameter="*ISO" /><br />
</field><br />
</lineFormat><br />
<br />
<lineFormat name="store" type="var" imageString="120######" /><br />
<br />
<lineFormat name="item" type="var" imageString="210#############" /><br />
<br />
<lineFormat name="quantity" type="var" imageString="220#######" ><br />
<field length="3" /><br />
<field length="6"><br />
<validator serviceprogram="FFPVALRNG" <br />
procedure="ffp_validator_range_create" parameter="1 99999" /><br />
</field><br />
</lineFormat><br />
<br />
<lineFormat name="end" type="const" imageString="999" /><br />
<br />
<inputProvider serviceprogram="FFPINSF" procedure="ffp_input_stmf_create" <br />
parameter="/home/iusr0001/src/ffp/example/xmlconfig-input.txt" /><br />
<br />
<lineProcessor serviceprogram="FFPPRCG" procedure="ffp_processor_grouping_create"<br />
parameter="id end FFPEX02EX" /><br />
<br />
<logger serviceprogram="FFPLOGJOBL" procedure="ffp_logger_joblog_create" /><br />
<br />
</config><br />
</code></div>
Mihael