Level: Intermediate Davor Gornik (dgornik@us.ibm.com), Product Manager, IBM
19 Sep 2006 COBOL copybooks are often considered to be "legacy data." Many companies rely on the information in those structures, so they need to be included in our data modeling process. In this article learn how to import COBOL copybooks in IBM® Rational® Data Architect and include them in the data model.
Introduction
Since Fix Pack 1, Rational Data Architect has been able to import COBOL copybooks as a logical data model. Importing as a physical model is not possible because physical data models in Rational Data Architect require database specification,
which is not part of the copybook specification. Copybooks have a simple structure containing a description of a data record.
Configuring Rational Data Architect
Several configuration changes are necessary to enable XML import and export interfaces in Rational Data Architect. To enable COBOL copybook import, you need to change the configuration parameters in the file:
C:\Program Files\IBM\Rational\RDA\V6.1\rda_prod\eclipse\plugins\com.ibm.datatools.metadata.wizards.miti.win32_1.0.0\MetaIntegration\conf\MIRModelBridges.xml
This assumes that Rational Data Architect is installed in C:\Program Files\IBM\Rational\RDA\V6.1.
The parameter that needs to be changed is:
<Bridge name="CobolCopybook" enabled="true">
<DisplayName enabled="true">- COBOL Copybook Flat Files</DisplayName>
</Bridge>
|
Be aware that for COBOL copybooks, documents-only import is possible.
Importing copybooks
In this section you learn how to prepare and start the import, select parameters, and evaluate results.
Preparing the import files
The copybooks are imported as .txt files. This requires that you copy or rename your copybook files to a file with the ending .txt. Each import is limited to a single copybook file.
Starting the import
To start the import, use the File > Import function of Rational Data Architect. In the displayed list of import filters (shown in Figure 1), select Data Model Import Wizard.
Figure 1. Import selection dialog
This step starts the wizard, where you specify what you want to import, the format of the import, and the expected result.
Selecting the parameters
As shown in Figure 2, you must select or input all parameters.
Figure 2. Define the copybook and model
- Model format
- The type of the input model. We need COBOL Copybook Flat Files.
- Model
- The complete path to the source file (model).
You can use Browse to search for the file.
Be aware that the file needs to end with .txt.
- Target project
- The name of the project in the current workspace where you would like to see the results.
- Model type
- The type of the import for COBOL copybooks should be Logical only.
- File name
- The name of the resulting model.
In this case, a logical model "Copybook import model.ldm" will be created in the selected Target project.
Following the basic specification about the source for the import and desired target, you can specify detailed parameters about the import, as shown in Figure 3.
Figure 3. Define detailed import options
- COBOL copybook parser start column number
- The start column in each row of the file for copybook information.
- COBOL copybook parser end column number
- The end column in each row of the file for copybook information.
- Run COBOL copybook parser in verbose mode
- Helps in identifying problems with detailed information about parsing.
- Expand multiply occurring records
- Parses the OCCURS x TIMES clause into separate records. This feature will be a numbered attribute for each occurrence.
In addition to selecting the parameters, you can also influence the workflow:
- Validity check
- Defines the level of checks that are executed before the import (basic, detailed, or none).
It is recommended to execute at lease some validity checks.
- Target database
- This parameter is not used for logical data models or for the COBOL copybook import to a logical model.
Evaluating results
You should always evaluate the status summary after executing the import. It might contain important information. Figure 4 shows an example.
Figure 4. Evaluate the summary
There are several types of messages in the summary:
- <INFO>
- Informational message about the configuration or finish of an activity.
- <STATUS>
- Informational message about process of an activity. Those messages are displayed after each phase of a longer activity.
- <WARNING>
- A message informing you of either a minor problem encountered (for example, missing link in the source) or about the generated model (for example, that diagrams do not have layout information).
Warnings typically mean that you should either check the part of the model the warning refers to and validate the content or that you have to do a manual step in the tool after the import is finalized.
- <ERROR>
- A message that has a serious effect for the resulting model. Either a concept is not understood, the source cannot be validated, or source cannot be opened.
- <FATAL>
- The import tool failed and is not able to create any results.
Example
The example in Listing 1 shows a simple import of a copybook named Copybook2.txt.
Listing 1. Importing a copybook
000100 01 PERSON-CREATION-REQUEST.
000200 05 PERSON-NAME-PART.
000300 10 PERSON-SALUTATION PIC X(10).
000400 10 PERSON-FIRST-NAME PIC X(20).
000500 10 PERSON-LAST-NAME PIC X(20).
000600 05 PERSON-DATE-OF-BIRTH PIC 9(08).
000700 05 PERSON-PHONE.
000800 10 PERSON-PHONE-AREA PIC X(08).
000900 10 PERSON-PHONE-NO PIC X(10).
001000 05 PERSON-ID-TYPE PIC X(06).
001100 05 PERSON-ID-DESCRIPT PIC X(25).
001200 05 PERSON-ID-VALUE PIC X(25).
|
This results in the logical data model have several entities, relationships, and attributes, as shown in Figure 5.
Figure 5. Resulting model
The resulting model includes entities to represent different levels of the structure, subtype relationships to represent the structure of the copybook, and attributes to represent the elements of the copybook.
Summary
It's critical for many companies to be able to continue using legacy data. Rational Data Architect enables developers to continue using this information in the data model.
Resources Learn
Get products and technologies
Discuss
About the author  | 
|  | Davor started his career as a software developer and architect in the early days of CASE, 4GL, and UNIX. His experience with technologies expanded to OO, UML, IE, SOA, RDBMS, II, and other acronyms. (Which explains why his writings do not contain any unexplained, three-letter abbreviations.) He is now a product manager with IBM and works with Common AD Tooling and DB Administration group. Outside of work he is a world traveler with a long history of international relocations, and many stories to tell about different parts of the world -- from San Marino to China, and including most of the continents. Additional hobbies include photography, remodeling, volleyball, and other sports. Contact Davor at dgornik@us.ibm.com. |
Rate this page
|