0

Can we parse as well as perform field validation(i.e. Datatype, Date format, Masking related) using Flatpack?

Currently I am using below xml to process fixed width file.

<?xml version='1.0'?>
<!DOCTYPE PZMAP SYSTEM  "flatpack.dtd" >
<PZMAP>
    <RECORD id="header" startPosition="1" endPosition="2"
        indicator="HD">
        <COLUMN name="RecordType" length="2" />
        <COLUMN name="SubmitCode" length="2" />
        <COLUMN name="RebateVRNumber" length="5" />
    </RECORD>
    <RECORD id="util" startPosition="1" endPosition="2"
        indicator="UD">
    <COLUMN name="RecordType" length="2" />
    <COLUMN name="ItemCode" length="6" />
    <COLUMN name="ItemName" length="70" />
    <COLUMN name="TotalQuantity" length="5" />
    <COLUMN name="OrderDate" length="8" />
    <COLUMN name="DiscountPercentage" length="6" />
    <COLUMN name="ContactNumber" length="12" />
    </RECORD>
    <RECORD id="trailer" startPosition="1" endPosition="2"
        indicator="TR">
        <COLUMN name="RecordType" length="2" />
        <COLUMN name="SubmitCode" length="2" />
    </RECORD>
</PZMAP> 

Apart from retrieving/parsing field values, I want to perform validation for some fields.

  1. OrderDate format should be YYYY-MM-DD
  2. DiscountPercentage should only contain value from 0-100 with 2 decimal points
  3. ContactNumber format should be XXX-XXX-XXXX
  4. TotalQuantity should be numeric only

Can we modify XML file or some other workaround for this using flatpack.dtd ?

Data_Geek
  • 11
  • 4

0 Answers0