Tuesday, February 8, 2022

XSD - How to create fixed length schema file

About Fixed Length file:

  • Fixed length files have a fixed length for each field and record.
  • Use Jdeveloper tool to define an adapter (file, ftp, aq) then you get to click on the 'define native format' button. Then choose 'Fixed Length' and follow the wizard.
  • The actual field data may be less than the length specified. In this case, you can specify paddedBy and padStyle as head or tail or none. when the data is read, the pads are trimmed accordingly.

Created sample fixed length file:

<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" xmlns:tns="http://www.oracle.com/FTPAdapter" targetNamespace="http://www.oracle.com/FTPAdapter" elementFormDefault="qualified" attributeFormDefault="unqualified" nxsd:version="NXSD" nxsd:stream="chars" nxsd:encoding="US-ASCII">

<xsd:element name="Employees"> <xsd:complexType> 

<xsd:sequence>

<xsd:element name="Employee" nxsd:style="array" nxsd:cellSeparatedBy="${eol}" minOccurs="1" maxOccurs="unbounded"> <xsd:complexType> 

<xsd:sequence> 

<xsd:element name="FName" type="xsd:string" nxsd:style="fixedLength" nxsd:length="8" nxsd:padStyle="tail"/> 

<xsd:element name="LName" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4"nxsd:padStyle="tail"/>

 <xsd:element name="Dept" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4" nxsd:padStyle="tail"/> 

</xsd:sequence> 

</xsd:complexType> 

</xsd:element> 

</xsd:sequence>

</xsd:complexType>

</xsd:element> 

</xsd:schema>

Steps with Screenshots(Created in Jdeveloper):




















No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...