Cobol Products
  
Home
Download
Buy
About
Contact Us
 

Cobol Tools Index
Data Viewer Index
Introduction
Features and Trial
Buy DataViewer
DataViewer Manual
Data Conversion Service
Contact Us

 
Data2Cr: Cobol Files in Crystal Reports

Data2Cr enables popular report generator Crystal Reports by Seagate Software to read Cobol data files directly.

Just imagine -- you can use the immense power of Crystal Reports to visually create reports that fully use fonts, graphics and other modern word processing goodies, and these reports will be filled with data read directly from your Cobol data files. You will never have to go through the hassles of the Report Section (or worse yet, plain Cobol) report generation again!

Features

  • File Formats Supported. Data2Cr reads MF, FSC, RM, Acu and Visual Cobol data files.

  • Speed. Cobol data files are read natively by our datafile libraries, without using ODBC or OLE DB layers, so report generation is really fast with Data2Cr.

  • Linking. You can link (join in SQL speak) several indexed Cobol data files using CR linking feature because Data2Cr supports fast reading of Cobol data files by index. You can also link from non-Cobol files to Cobol files.

  • Crystal Versions Supported. We tested Data2Cr with Crystal Reports versions 5, 6, 7 and 8 and found it to work very well.

User Manual: Introduction

Crystal Reports reads data files and databases using data sources. Data Source is a DLL that is located in <WindowsDir>\Crystal folder. When it is time to read a data file or a database into report, Crystal Reports calls one of these DLLs to actually read the file.

Install Data2Cr. When you install DataViewer, it adds P2BCOBOOL.DLL to <WindowsDir>\Crystal folder. If installation was successful, installer will inform you about changes made to the Crystal folder. When you start the Crystal Reports application after Data2Cr installation, it will load all data source DLLs including the new Cobol Data File Reader DLL that you installed.

FDD file descriptors. Since Cobol data files do not have record layout information embedded in them, your report should open not the data file itself but the *.FDD file that contains record layout and link to the actual data file.

How To Create FDD file for your Data File. Use Data-Viewer to create an FDD file that describes your data file. FDD file is simply a saved layout file.

How To Open Cobol Data File in Crystal Reports. When designing new report in Crystal Report Designer you start "Standard Report Expert" by selecting "File. New". Click on "Data File" (or "Database" in newer CR versions).

"Choose Database File" dialogue will appear. In it change "Files of type" to "All Files". Select and open a file with *.FDD extension that represents the data file that you want to read. Do NOT select the Cobol DATA FILE itself -- it will NOT work. The FDD file will be added to the list of files. Click "Done" and dialog will close.

Click the "Fields" tab and you will see a list of fields available in your file. Select the fields you want to include into your report and click "Add". Or click "Add All" to include all fierlds. Then click "Preview Report" and you will see the actual data from your Cobol data file in a Crystal Reports report.

This is what happens when Crystal reads the FDD file:
* CR finds that only our P2BCOBOL.DLL can read the FDD file and passes control to our DLL,
* P2BCOBOL.DLL reads the FDD file that you selected and extracts file information from it,
* Finally our DLL reads data from the Cobol data file referenced by the FDD file, and it returns the converted Cobol data back to Crystal Reports.

Now download DataViewer (a package that includes Data2Cr) and see for yourself how a Cobol data file is opened in CR.

Download and Run Data2Cr Evaluation

Data2Cr trial version is available for download now as a part of Data-Viewer.

Please proceed to Cobol Data File Readers Evaluation Page. You will return here after the download.

In this example we create a report from Micro Focus (MF) data file. All sample files are located in folder "Program Files\ Siber Systems\ DataViewer\ Sample Data Files".

MF Cobol program file-mf.cob that includes copybook file-mf.cpy generates MF data file file-mf.dat. You can compile and run the program yourself or use the enclosed data file file-mf.dat.

Start with generating FDD file:
* Open data file file-mf.dat in DataViewer. It guesses the record layout of the file.
* Since we have the original file layout in copybook file-mf.cpy, select "File. Load Layout from Copybook" and parse file file-mf.cpy. Click "Apply" to make the parsed layout effective.
* Select "File. Save Layout" and save the generated layout to file file-mf.fdd.

Now run the Crystal Reports itself.
* Start "Seagate Crystal Reports Designer".
* Create new Standard report by selecting "File. New".
* Click "DataFile" button. List files of type "All files". Select file file-mf.fdd.
* Once the FDD file is parsed in, click Done to close the dialogue.
* Click the "Fields" tab. Click "Add All" to add all of them to the report.
* Click "Preview Report" to see the report generated from the Cobol data file.

Licensing Data2Cr

If you plan to use Data2Cr internally on Four (4) computers or less, then you need Data2Cr Non-Redistributable License that is included into Data-Viewer package.

If you want to distribute application that generates reports from Cobol data files using Data2Cr and Crystal Reports then you need Data2Cr Redistributable license. Please contact us for details.

User Manual: Advanced

DLL conflicts. Standard P2BBDE.DLL that comes with CR recognizes any file that is longer than 31 bytes as its own. It recognizes FDD files too (if they are longer than 31 bytes) and therefore it prevents our P2BCOBOL.DLL from recognizing FDD file. When P2BBDE.DLL takes over, you would see only "FIELD1" in the list of fields and nothing else.

In Crystal Reports ver 6 and later there is a bug in P2BBTRV.DLL. It sometimes results in error message "Could not open pdbbtrv.dll. Please check its configuration" when you try to open FDD file. Whether the bug appears or not depends on physical order of DLLs in directory.

Our preferred method of fixing it (it is implemented by Data2Cr installer) is: Remove P2BBDE.DLL and P2BBTRV.DLL from $systemroot\Crystal. Save it in some other directory, say, $systemroot\CrystalDisabled, so that when you need its functionality, you can move it back to $systemroot\Crystal.

Shortcomings: Paradox, Btrieve and other databases that are read by P2BBDE.DLL and P2BBTRV.DLL will not be loadable to CR. Advantages: simple and makes Cobol stuff work. Crystal Reports 4.5 has no P2BBDE.DLL, so there is no need to remove it.

Y2K issues. In Crystal Reports, all dates are represented in the YYYY format. But Cobol data files may contain year in the YY format. To fix this problem, DataAccess library automatically converts 2-digits-year dates to 4-digits-year dates. The conversion rule is the following: if year is less than 40, then convert it to 20YY, otherwise, convert it to 19YY.

Linking Files in Data2Cr. You can link to and from Cobol data files as long as these rules are followed:

* Definitions: - You link two files by a set of one or more fields (lf1, lf2, ..., lfN). - Each indexed Cobol file contains one or more indices. Each index consists of one or more fields: i1 = (f11, ..., f1N), ..., iM = (fM1, ..., fMN). The index fields can be disjoint (example: 2-field index: field1: bytes 0 to 4, field2: bytes 10 to 14). Only indexed files have indices. Sequential and relative files are not indexed. - For every N-field index i = (f1, ..., fN) Data2Cr generates N-1 virtual partial indices i1 = (f1), i2=(f1,f2), ..., iN-1 = (f1,...,fN-1). Partial indices are built from the main physical index by disregarding values of less senior fields. * Rules: - The "Link From" set of fields (or Master fields) can be any set of fields in the Cobol data file. These fields can be not a part of any index at all. - The "Link To" set of fields (or Slave fields) must form a valid index of the Cobol data file, this index can be either a physical Cobol data file index or a virtual partial index built by Data2Cr. * How to do it in Visual Linking Expert: - If you have index i = (f1, ..., fN) then field f1 to fN-1 will be shown as gray because they participate in more than one index (main index plus virtual partial indices) AND the field fN will be shown as color-coded. - Link any set of field belonging to one index and then double-click one of the links itself. "Link Options" dialogue will be shown and several indices will be offered. Select the index that exactly covers the "linked to" set of fields. * How CR Indices Are Created By Data2Cr: Crystal Reports asks Data2Cr P2BCOBOL.DLL for a list of field sets that can be "linked to". This is how our DLL computes this list: a) We read the header of the physical indexed data file and we get the index layout information in the form: Index 1: N1 components. Component 1: offset o1, length l1 ... Component N1: offset oN1, length lN1 Index 2: N2 components. Component 1: offset o1, length l1 ... Component N2: offset oN2, length lN2 ... Index M: Component 1: offset o1, length l1 ... Component NM: offset oNM, length lNM b) For each component of each index we find all RDD fields or concatenation of RDD fields that cover this component. c) If every component of an index has at least one set of RDD fields that cover it then the entire index can be covered by RDD fields and we report these combinations of RDD fields to CR. d) We build partial virtual indices from the main physical index. The data item "mykey" that is an index key is defined as: 05 mykey pic 9(5)V99. 05 mykey-breakdown redefines mykey. 10 mykey-int pic 9(5). 10 mykey-fract pic 99. Then we will report to CR two indices: - mykey - mykey-int, mykey-fract * Extended Example: You have two data files. The first file is called PARTS, it contains a list of parts that you sell and the file has this 2-field index: 05 PRODUCER-CODE PIC 9999. 05 PART-CODE PIC XXXXXX. The second file is called TRANSACTIONS, it contains a list of sell transactions, every transaction sells a part. It has this 3-field index (SOLD-SEQ is sequential number for each part that start 1 and increases by 1 for each part of the kind sold): 05 PRODUCER-CODE PIC 9999. 05 PART-CODE PIC XXXXXX. 05 SOLD-SEQ PIC 9999. You want to link (PARTS:PRODUCER-CODE,PARTS:PART-CODE) to (TRANSACTIONS:PRODUCER-CODE,TRANSACTIONS:PART-CODE) and display the resulting join table in Crystal Reports. Link PARTS:PRODUCER-CODE to TRANSACTIONS:PRODUCER-CODE and PARTS:PART-CODE to TRANSACTIONS:PART-CODE. Then doubkle click any of the links and select index (PRODUCER-CODE,PART-CODE). Your linking is now done. Please note that you are linking to virtual partiual index (TRANSACTIONS:PRODUCER-CODE,TRANSACTIONS:PART-CODE) that was made by Data2Cr from phyusical index (TRANSACTIONS:PRODUCER-CODE,TRANSACTIONS:PART-CODE,TRANSACTIONS:SOLD-SEQ)
Siber Systems
Copyright © 1997-2010 by Siber Systems Inc.