One Star

XML to Cobol Copybook Transformations

Hello: I'm evaluating Talend and the use case I'm trying to solve is transforming an XML document into a COBOL copybook layout. I've read various posts about using a tFileOutputEBCDIC. And the need to use cobol2j to translate the COBOL copybook into an *.xc2j file for use by Talend.
But, I cannot get it to work. Can someone help me or point me to some step by step directions?
Here's what I've done:
1) Ran cobol2j's cb2xc2j.bat against my copybook layout. It created an xc2j file.
2) Dropped a tFileOutputEBCDIC component onto my Job designer workspace
3) Changed the Basic Settings of the tFile OutputEBCIDC component to point to the xc2j file from step #1
4) Dropped an XML document onto my workspace
5) Dropped a tMap component onto my workspace
6) Linked the XML document to the tMap component
7) Linked the tMap to the tFileOutputEBCDIC - a window pops up asking for new Output name; I enter one and click ok
The tFileOutputEBCDIC component now has an error stating "No schema has been defined yet". And when I double click the tMap component, the output has no columns.
3 REPLIES
One Star

Re: XML to Cobol Copybook Transformations

See 5.15 Setting up a Copybook Connection in the Design Studio user guide. Section 5.15.4 describes how to collect the schema.
One Star

Re: XML to Cobol Copybook Transformations

Where is the Design Studio User's Guide? I see an Open Studio User's Guide on the Documentation page. But, section 5.15 is entitled "Exporting Metadata as context".
One Star

Re: XML to Cobol Copybook Transformations

Sorry doesn't seem to be in the comunity edition. This is what mine says without the pictures.
5.15.4 Step 4: collecting the schemas
This step enables to collect the schemas describing the EBCDIC file data.
? Right-click the Copybook metadata you have just created.
? Select the Retrieve Schema option in the menu to open the wizard.
The xc2j file data area displays the content of the xc2j file. The Ebcdic Schema area displays the
various schemas detected in the EBCDIC file. In this example, the file contains three different
schemas called 01, 04, and 05.
? It is possible to rename the schemas, just click their name and enter a new one. The
distinguishFieldValue=?SchemaName? code, which enables to distinguish
between the different schemas, will contain the new names.
? Click Next to open a new view on the wizard.
The new view lists the schemas extracted from the EBCDIC file.
? Select one or more schemas from the list or click the Select All button if you want to collect
all of them.
? The Name column displays the schemas names, the Column number column indicates how
many columns there are in each of the schemas and the Creation status column indicates if
the schemas have been collected successfully or not.
? Click Next once you have made your selection.
The new view on the wizard enables you to define the schemas to be created.
When you select a schema in the Schema area to the left, its name displays in the Name field and
its structure displays in the lower-right Schema area.
You can modify the schema name and its description according to your needs. In the Schema area,
you can for example:
- modify the column name,
- define a column as a primary key by selecting the corresponding check box in the Key column,
- modify the column type,
- define columns as nullable,
- preserve the EBCDIC encoding instead of converting it into ASCII by selecting the corresponding
check box in the Untranspose column,
- enter the date pattern you want to use in the Date Pattern column,
- set data length in the Length column.
The toolbar enables you as well to add, remove or reposition the schema columns. You can also
import an XML schema from a file or export the current schema in XML format.
? Click Finish to complete the creation of the schemas.
All the schemas you created display under the node of your Copybook connection.