FFReport
|
One way to define a Fixed Width Flat file is via a Xml Layout This package can use a JRecord Xml Layout. Typicaly a Xml Layout looks like
1:<?xml version="1.0" ?> 2:<RECORD RECORDNAME="DTAR020" COPYBOOK="DTAR020" DELIMITER="<Tab>" 3: FONTNAME="CP037" FILESTRUCTURE="Default" STYLE="0" RECORDTYPE="RecordLayout" 4: LIST="Y" QUOTE="" RecSep="default"> 5: <FIELDS> 6: <FIELD NAME="KEYCODE-NO" POSITION="1" LENGTH="8" TYPE="Char" /> 7: <FIELD NAME="STORE-NO" POSITION="9" LENGTH="2" TYPE="Mainframe Packed Decimal (comp-3)" /> 8: <FIELD NAME="DATE" POSITION="11" LENGTH="4" TYPE="Mainframe Packed Decimal (comp-3)" /> 9: <FIELD NAME="DEPT-NO" POSITION="15" LENGTH="2" TYPE="Mainframe Packed Decimal (comp-3)" /> 10: <FIELD NAME="QTY-SOLD" POSITION="17" LENGTH="5" TYPE="Mainframe Packed Decimal (comp-3)" /> 11: <FIELD NAME="SALE-PRICE" POSITION="22" LENGTH="6" DECIMAL="2" TYPE="Mainframe Packed Decimal (comp-3)" /> 12: </FIELDS> 13:</RECORD>
There is a wizard ("Xml Layout Wizard") that will define your Xml layout by pointing and clicking at the fields in a sample file.
As for all the interfaces in this package, there is both a IReportConnection (IReport Specific) and JRDataSourceProvider (Generic designer) interfaces to Xml-Layouts.
For a description of the Xml Tags see "XML Tags". For some Xml examples please see "RecordEditor XML"
If using iReports, for RecordEditor-Xml Reports, you should use the RecordEditor-Xml Connection class, This can be selected in the connection Combo:
One of the easiest ways to get started is to use IReports Report Wizard. To do this:
Note: The Blank* Templates can not be used with the ReportWizard.
Note: Quite a few of the Templates will not work with Linux, I have created Linux versions of these Templates (on Fedora 11), which should be better.
then click on the next button
Field | Description |
File | Data file to be used in the report. |
Record Layout | RecordEditor-Xml Layout Definition |
Build Layout Button | Wizard to create a layout from the file. See "Xml Layout Wizard" for more details. |
Define fields as numeric | Old field |
Report Record | Primary report record. When this record comes up, data will be passed back to Jasper Reports Typically it will be the main detail line of the report. |
Record | Records to be used in the Report |
Note: Make sure that you have RecordEditor-Xml Connection selection
To create a report from scratch
Field | Description |
File | Data file to be used in the report. |
Record Layout | RecordEditor Layout Definition |
Define fields as numeric | Old field |
Report Record | Primary report record. When this record comes up, data will be passed back to Jasper Reports Typically it will be the main detail line of the report. |
Record | Records to be used in the Report |
The generated report may look something like this:
I also supply the RecordEditor-Xml provider class net.sf.FFReport.Provider.RecordXmlDataSourceProvider , this implements the standard jasper reports Design interface (JRDataSourceProvider). You should be able to use this class in any Jasper Report Designer that supports this interface. In iReports you are better off using "Cobol Connection" but if want, you can try the provider class in iReports. Just be aware that JRDataSourceProvider's do not work in all versions of iReports e.g. Version 3.7.3.
The class net.sf.FFReport.Provider.RecordXmlDataSourceProvider implements JRDataSourceProvider and acts as the interface between iReports and the RecordDataSource (file based data source for a report).
Steps:
Note: The class name is net.sf.FFReport.Provider.RecordXmlDataSourceProvider
First you need to create a report (File >>> New), then
Field | Description |
File | Data file to be used in the report. |
Record Layout | RecordEditor-Xml Layout Definition |
Build Layout Button | Wizard to create a layout from the file. See "Xml Layout Wizard" for more details. |
Define fields as numeric | Old field |
Report Record | Primary report record. When this record comes up, data will be passed back to Jasper Reports Typically it will be the main detail line of the report. |
Record | Records to be used in the Report |
FFReport at SourceForge | Download Page | Forums |