Using the Data Convert tool to transform EBCDIC ... - Micro Focus
Using the Data Convert tool to transform EBCDIC ... - Micro Focus
Using the Data Convert tool to transform EBCDIC ... - Micro Focus
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Using</strong> <strong>the</strong> <strong>Data</strong> <strong>Convert</strong> <strong><strong>to</strong>ol</strong> <strong>to</strong> <strong>transform</strong> <strong>EBCDIC</strong>/ASCII files<br />
This article provides an example taking a mainframe <strong>EBCDIC</strong> file and using<br />
<strong>Data</strong> <strong>Convert</strong> <strong><strong>to</strong>ol</strong> <strong>to</strong> convert <strong>to</strong> a ASCII file and <strong>the</strong>n taking <strong>the</strong> ASCII file<br />
and convert back using <strong>Data</strong> <strong>Convert</strong> <strong><strong>to</strong>ol</strong> <strong>to</strong> a <strong>EBCDIC</strong> file <strong>to</strong> upload on<strong>to</strong><br />
Mainframe. This maps <strong>the</strong> processes that can be useful for cus<strong>to</strong>mers who<br />
have <strong>to</strong> move data <strong>to</strong> and from <strong>the</strong>ir mainframe.<br />
This example uses a sample mainframe <strong>EBCDIC</strong> datafile (MainFrame-<br />
<strong>EBCDIC</strong>.dat) <strong>to</strong> demonstrate how <strong>to</strong> use <strong>Data</strong> <strong>Convert</strong> <strong><strong>to</strong>ol</strong> for this task. The<br />
project files (programs, data files, etc.) supporting this example can be<br />
downloaded <strong>to</strong> allow you <strong>to</strong> examine <strong>the</strong> process more closely. Since <strong>the</strong><br />
<strong>Data</strong> <strong>Convert</strong> <strong><strong>to</strong>ol</strong> is a part of both Net Express and Mainframe Express, <strong>the</strong><br />
information presented here is applicable <strong>to</strong> both products.<br />
1) Open <strong>the</strong> project <strong>EBCDIC</strong>-ASCII-convert.app from <strong>the</strong><br />
<strong>EBCDIC</strong>_ASCII_convert folder.<br />
2) On <strong>the</strong> right hand side of project highlight and drag over <strong>to</strong> generic<br />
debug window <strong>the</strong> <strong>EBCDIC</strong>-layout.cbl and build <strong>the</strong> <strong>EBCDIC</strong>-layout.int.<br />
3) Right mouse click on <strong>EBCDIC</strong>-layout.cbl and click on Build settings.<br />
Click on <strong>the</strong> Compile tab and add <strong>the</strong> following <strong>to</strong> <strong>the</strong> Directives<br />
window.<br />
Charset(<strong>EBCDIC</strong>) sign(<strong>EBCDIC</strong>)<br />
4) Do Project -> Update all dependencies, Do Project -> Rebuild all<br />
5) Right mouse click on <strong>EBCDIC</strong>-layout.CBL and click on Create Record<br />
Layout.<br />
6) Right mouse click on 01 SEG-RPCMTDTP-CEAC and click on New<br />
layout.<br />
7) Net Express/Mainframe Express window will appear,<br />
Scap<strong>to</strong>pc.idy <strong>EBCDIC</strong><br />
<strong>Data</strong><strong><strong>to</strong>ol</strong>s ANSI<br />
Click on Yes.<br />
8) Layout window will appear,<br />
On left hand side, Scroll down <strong>to</strong> group item 01 SEG-RPCMTDTP-CEAC<br />
Right mouse click and select New Layout<br />
Default layout, click Next<br />
Click Finish<br />
Do a File -> Save as<br />
Change File name <strong>to</strong> <strong>EBCDIC</strong>-layout.str and save <strong>the</strong> file.
9) In <strong>the</strong> current <strong>EBCDIC</strong>-ASCII-convert.app project, Open <strong>the</strong> <strong>EBCDIC</strong>layout.cbl<br />
Search for SEG-RPCMTDTP-CEAC<br />
Select <strong>the</strong> o1 and 05 levels for this group item and right mouse click,<br />
select copy<br />
Save program as ASCII-layout.cbl.<br />
10) Next, Delete everything on left hand side of <strong>the</strong> project.<br />
Now, from <strong>the</strong> right hand side, add ASCII-layout.cbl<br />
Hightlight and drag <strong>the</strong> ASCII-layout.cbl over <strong>to</strong> <strong>the</strong> generic debug<br />
build and build <strong>the</strong> ASCII-layout.int<br />
Right mouse click on ASCII-layout.cbl and click on build settings<br />
Click on <strong>the</strong> compile tab and add <strong>the</strong> following<br />
Charset(ASCII) sign(<strong>EBCDIC</strong>)<br />
Do Project-> update all dependencies, Project-> Rebuild all.<br />
Now you should have <strong>the</strong> ASCII-layout.int built correctly.<br />
.<br />
Example of ASCII-layout.cbl.<br />
ASCII-LAYOUT.CBL<br />
program-id. ASCII-layout.<br />
environment division.<br />
data division.<br />
01 SEG-RPCMTDTP-CEAC.<br />
05 CMTDTP-CLE-SEG-RPCMT-CEAC.<br />
10 CMTDTP-EL-NO-GR-COCEAC PIC X(10).<br />
10 CMTDTP-EL-NO-COCEAC PIC X(10).<br />
05 CMTDTP-EL-CLE-SEG-RPCMTCRP-CEA.<br />
10 CMTDTP-EL-CD-TYP-PER-CRP-CEAC PIC X.<br />
* 10 CMTDTP-EL-DT-DEB-PER-CRP-CEAC PIC X(8).<br />
10 CMTDTP-EL-DT-DEB-PER-CRP-CEAC PIC X(6).<br />
05 CMTDTP-EL-CLE-SEG-RPCRPCRG-CEA.<br />
10 CTMDTP-EL-CD-GAR-CRG-COCEAC PIC X(5).<br />
05 EL-NO-SEQ-CLE-DTP-COCEAC.<br />
07 EL-NO-SEQ-CLE-DTP-CO-NUMCEA PIC 9(5).<br />
05 EL-PRI-COUR-APR-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-PRI-AJU-APR-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-CD-RAIS-TX-APR-DTP-COCEAC PIC X.<br />
05 EL-DT-TX-APR-DTP-COCEAC PIC 9(8).<br />
05 EL-PRI-COUR-ENC-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-PRI-AJU-ENC-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-CD-RAIS-TX-ENC-DTP-COCEAC PIC X.<br />
05 EL-DT-TX-ENC-DTP-COCEAC PIC 9(8).<br />
05 EL-MT-TX-PRI-EXO-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-MT-TX-PRI-DIVD-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-MT-ORIG-CHQ-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-DT-RECEP-CHQ-DTP-COCEAC PIC 9(8).<br />
05 EL-PRI-ENC-PRV-NON-GAG-DTP-CEA PIC S9(7)V99.<br />
05 EL-MT-TX-COR-AJU-DTP-COCEAC PIC S9(7)V99.<br />
05 EL-MT-TX-COR-PRI-DTP-COCEAC PIC S9(7)V99.<br />
procedure division.<br />
exit program.
11) After Rebuilding this program, right mouse click on ASCIIlayout.cbl<br />
and create new layout.<br />
12) Right mouse click on 01 SEG-RPCMTDTP-CEAC and click on New<br />
layout.<br />
13) Layout window will appear,<br />
On left hand side, Scroll down <strong>to</strong> group item 01 SEG-RPCMTDTP-CEAC<br />
Right mouse click and select New Layout<br />
Default layout, click Next<br />
Click Finish<br />
Do a File -> Save as<br />
Change File name <strong>to</strong> ASCII-layout.str and save <strong>the</strong> file.<br />
Now ready <strong>to</strong> use <strong>the</strong> <strong>Data</strong> Tools -> <strong>Convert</strong> utility.<br />
Open <strong>the</strong> <strong>EBCDIC</strong>_ASCII_convert.app project.<br />
On <strong>the</strong> left hand side , you should rebuild only <strong>the</strong> <strong>EBCDIC</strong>-layout.cbl <strong>to</strong><br />
<strong>EBCDIC</strong>-layout.int<br />
Only this program <strong>EBCDIC</strong>-layout should be in generic debug build.<br />
Update all dependencies , rebuild all.<br />
First , convert <strong>the</strong> mainframe <strong>EBCDIC</strong> file MainFrame-<strong>EBCDIC</strong>.dat <strong>to</strong> a ASCII<br />
file using<br />
Tools-> <strong>Data</strong> Tools -> <strong>Convert</strong> in <strong>the</strong> Net Express/Mainframe Express IDE.
Enter <strong>the</strong> following:<br />
Input file<br />
Filename: MainFrame-<strong>EBCDIC</strong>.dat<br />
A window will appear, put in 153 for maximum record length.<br />
Change character set from ANSI <strong>to</strong> <strong>EBCDIC</strong><br />
Character set conversion<br />
Check <strong>Convert</strong> character set.<br />
Since <strong>the</strong> MainFrame-<strong>EBCDIC</strong>.dat file does not contain packed<br />
fields , do not<br />
need To check “Record contains non-text items. If <strong>the</strong> file did<br />
contain non-<br />
text items (packed decimal fields), <strong>the</strong>n you would enter a<br />
structure file layout<br />
for <strong>the</strong> file.<br />
For New File<br />
Filename: d:\<strong>EBCDIC</strong>_ASCII_convert\convert_<strong>to</strong>_ASCII.dat
Click <strong>Convert</strong>.<br />
The <strong>Convert</strong> utility will convert 58 records.<br />
Next, Will convert convert_<strong>to</strong>_ASCII.dat (ASCII)file back <strong>to</strong> a<br />
convert_ASCII_back<strong>to</strong>_<strong>EBCDIC</strong>.dat (<strong>EBCDIC</strong>)file.<br />
First delete everything in generic debug build.<br />
Highlight and drag over <strong>to</strong> generic debug build <strong>the</strong> ASCII-layout.cbl<br />
Next, for <strong>the</strong> ASCII-layout.cbl do Poject -> Update all dependencies, Project -<br />
> Rebuild all<br />
Now, do <strong>the</strong> Tools-> <strong>Data</strong> Tools -> <strong>Convert</strong><br />
Enter <strong>the</strong> following:<br />
Inputfile<br />
Filename: d:\<strong>EBCDIC</strong>_ASCII_convert\convert_<strong>to</strong>_ASCII.dat<br />
Enter 153 for maximum record length.<br />
Change character set from <strong>EBCDIC</strong> <strong>to</strong> ANSI.
Newfile<br />
Change filename <strong>to</strong><br />
d:\<strong>EBCDIC</strong>_ASCII_convert\convert_ASCII_back<strong>to</strong>_<strong>EBCDIC</strong>.dat<br />
Click on <strong>Convert</strong> and 58 records will be converted.<br />
Close <strong>the</strong> Project and files.<br />
The following files are now in <strong>the</strong> <strong>EBCDIC</strong>_ASCII_convert folder<br />
1) Original mainframe <strong>EBCDIC</strong> file: MainFrame-<strong>EBCDIC</strong>.dat<br />
2) <strong>Convert</strong>ed ASCII file: convert_<strong>to</strong>_ASCII.dat<br />
3) <strong>Convert</strong>ed back <strong>to</strong> <strong>EBCDIC</strong> file from ASCII file:<br />
convert_ASCII_back<strong>to</strong>_<strong>EBCDIC</strong>.dat<br />
The trick now is <strong>to</strong> use <strong>the</strong> appropriate Structure file (.str) depending on<br />
which file that is being viewed is ei<strong>the</strong>r ASCII or <strong>EBCDIC</strong>.<br />
For example,
Depending on <strong>the</strong> file being open, need <strong>to</strong> be in <strong>the</strong> correct structure file<br />
for <strong>EBCDIC</strong> use <strong>EBCDIC</strong>.str or for ASCII use ASCII.str.<br />
First , load and rebuild in generic debug build <strong>the</strong> ASCII-layout.cbl <strong>to</strong><br />
ASCII-layout.int<br />
Open up <strong>the</strong> convert_<strong>to</strong>_ASCII.dat file in <strong>the</strong> <strong>EBCDIC</strong>_ASCII_convert<br />
folder.<br />
Do File ->Open<br />
Change file of type <strong>to</strong> data file *.dat<br />
Open <strong>the</strong> convert_<strong>to</strong>_ASCII.dat with 153 maximum record length.<br />
You can save a profile for this file if prompted.<br />
NOTE:<br />
When opening up one of <strong>the</strong> data files , and <strong>the</strong> following ********<br />
appear in <strong>the</strong> value fields <strong>the</strong>n ei<strong>the</strong>r <strong>the</strong> structure file (.str ) was created<br />
wrong or <strong>the</strong> wrong structure file was used <strong>to</strong> convert , <strong>the</strong>n delete <strong>the</strong><br />
data file and load <strong>the</strong> appropriate cobol program and rebuild one for<br />
<strong>EBCDIC</strong> (<strong>EBCDIC</strong>-layout.cbl) or one for ASCII (ASCII-layout.cbl) before<br />
converting <strong>the</strong> file. Make sure update all dependencies, rebuild all in <strong>the</strong><br />
project before converting.<br />
Also, 2 projects can be created for <strong>the</strong> layouts, one for ASCII layout and<br />
ano<strong>the</strong>r for <strong>EBCDIC</strong> layout.
Reference Knowledge Base Document #21088