Monthly Summary Report using DFDL

Recently we have been asked to design a message model which shows as a report like below. It was a nice report and they want the same intact.

Entry       Per         Post Date   GL Account  Description                                                                                                                                                                                                                                                     
--------------------------------------------------------------
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test                                              
16524       01          09/15/2018  123456      Test

After playing with DFDL Fixed Length format couple of times, we were able to achieve the desired format and it was really interesting when you know the power and simplicity of DFDL. The message model created is

 

<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:recFixLengthFieldsFmt="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat">

    <xsd:import namespace="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat" schemaLocation="IBMdefined/RecordFixLengthFieldFormat.xsd"/>
        <xsd:simpleType dfdl:length="150" dfdl:terminator="" dfdl:textStringPadCharacter="-" name="border">
    <xsd:restriction base="xsd:string"/>
  </xsd:simpleType>
    <xsd:complexType name="Header">
    <xsd:sequence dfdl:separator="%SP;%SP;">
      <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="Entry" name="Entry" type="xsd:string"/>
      <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="Per" name="Per" type="xsd:string"/>
      <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="Post Date" name="PostDate" type="xsd:string"/>
      <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="GL Account" name="GLAccount" type="xsd:string"/>
      <xsd:element dfdl:length="256" ibmDfdlExtn:sampleValue="Description" name="Descrption" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
    <xsd:annotation>
    <xsd:appinfo source="http://www.ogf.org/dfdl/">
      <dfdl:format encoding="{$dfdl:encoding}" escapeSchemeRef="" occursCountKind="fixed" ref="recFixLengthFieldsFmt:RecordFixLengthFieldsFormat" textPadKind="padChar"/>
    </xsd:appinfo>
  </xsd:annotation>

  <xsd:element dfdl:lengthKind="delimited" ibmSchExtn:docRoot="true" name="FLength">
    <xsd:complexType>
      <xsd:sequence dfdl:separator="%CR;%LF;%WSP*;" dfdl:separatorSuppressionPolicy="anyEmpty">
                				<xsd:element dfdl:lengthKind="delimited" name="header" type="Header"/>
                <xsd:element ibmDfdlExtn:sampleValue="" name="border" type="border"/>
                <xsd:element dfdl:lengthKind="delimited" dfdl:occursCountKind="implicit" ibmDfdlExtn:sampleOccurs="10" maxOccurs="unbounded" name="body">
          <xsd:complexType>
            <xsd:sequence dfdl:separator="%SP;%SP;">
              <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="16524" name="Entry" type="xsd:string"/>
              <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="01" name="Per" type="xsd:string"/>
              <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="09/15/2018" name="PostDate" type="xsd:string"/>
                            <xsd:element dfdl:length="10" ibmDfdlExtn:sampleValue="123456" name="GLAccount" type="xsd:string"/>
                            <xsd:element dfdl:length="50" dfdl:textPadKind="padChar" ibmDfdlExtn:sampleValue="Test" name="Description" type="xsd:string"/>
                                                                                                                                                                    </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
                			                        </xsd:sequence>
    </xsd:complexType>
  </xsd:element>


</xsd:schema>

If you have any requirements in DFDL Message modelling, connect with us at support@vaithu.com/+1 6123058684.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.