The “data definition string” parameter required to import data from MainFrame files may quickly become quite complex. This is why we advise you to use the little tool that automatically generates the “data definition string” parameter from the COBOL code that generated the file. Here is how this tool works:
Most of the MainFrames files have the following properties:
•Character Encoding: Use EBCDIC (cp037_IBMUSCanada)
•Endianness: Big endian
For example, let’s assume that we have an input file that contains a table with 2 columns: The first column is a “Double Precision Floating Point Number” and the second column is a “Signed integer with 9 digits max” (and both columns are “little endian” because they originates from an Intel-based-machine). The “data definition string” parameter required to import this file is: “D,I”. If we know that the second column actually contains only positive numbers, we could also have used “D,K” (but this is dangerous because any negative number inside the second column will give unexpected results when using “D,K”: i.e. This is flagged as a “dangerous option” in the above summary table).
The procedure to automagically create the “data definition string” parameter from the COBOL code is the following:
1.Click the button named “Extract the "Data Definition String" from a cobol code”: The COBOL importation tool appears.
2.Copy/paste your COBOL code (i.e. the "PIC" declarations) inside the central text field inside the COBOL importation tool:
3.Click on the "import" button:
The following window appears:
If you stop the importation procedure at this point, you won’t get the proper column names (you’ll get instead C1, C2, C3,… as column names)
4.Add a "ColumnRename" action, open the properties of this new action and click on the "Paste Table" button:
5.You should now have: