Sample on taking a mainframe ebcdic file and using Data ...



Sample on taking a mainframe ebcdic file and using Data Convert tool to convert to a ascii file and then taking the ascii file and convert back using Data Convert tool to a ebcdic file to upload onto Mainframe.

Using a sample mainframe ebcdic datafile (MainFrame-ebcdic.dat) to demonstrate how to use Data Convert tool for this task.

1) Open the project ebcdic-ascii-convert.app from the ebcdic_ascii_convert folder.

2) On the right hand side of project highlight and drag over to generic debug window the ebcdic-layout.cbl and build the ebcdic-layout.int.

3) Right mouse click on ebcdic-layout.cbl and click on Build settings.

Click on the Compile tab and add the following to the Directives window.

Charset(ebcdic) sign(ebcdic)

4) Do Project -> Update all dependencies, Do Project -> Rebuild all

5) Right mouse click on ebcdic-layout.CBL and click on Create Record Layout.

6) Right mouse click on 01 SEG-RPCMTDTP-CEAC and click on New layout.

7) Net Express window will appear,

Scaptopc.idy EBCDIC

Datatools ANSI

Click on Yes.

8) Layout window will appear,

On left hand side, Scroll down to group item 01 SEG-RPCMTDTP-CEAC

Right mouse click and select New Layout

Default layout, click Next

Click Finish

Do a File -> Save as

Change File name to EBCDIC-layout.str and save the file.

9) In the current ebcdic-ascii-convert.app project, Open the ebcdic-layout.cbl

Search for SEG-RPCMTDTP-CEAC

Select the o1 and 05 levels for this group item and right mouse click, select copy

Save program as ascii-layout.cbl.

10) Next, Delete everything on left hand side of the project.

Now, from the right hand side, add ascii-layout.cbl

Hightlight and drag the ascii-layout.cbl over to the generic debug build and build the ascii-layout.int

Right mouse click on ascii-layout.cbl and click on build settings

Click on the compile tab and add the following

Charset(ascii) sign(ebcdic)

Do Project-> update all dependencies, Project-> Rebuild all.

Now you should have the ascii-layout.int built correctly.

.

Example of ascii-layout.cbl.

ASCII-LAYOUT.CBL

program-id. ascii-layout.

environment division.

data division.

01 SEG-RPCMTDTP-CEAC.

05 CMTDTP-CLE-SEG-RPCMT-CEAC.

10 CMTDTP-EL-NO-GR-COCEAC PIC X(10).

10 CMTDTP-EL-NO-COCEAC PIC X(10).

05 CMTDTP-EL-CLE-SEG-RPCMTCRP-CEA.

10 CMTDTP-EL-CD-TYP-PER-CRP-CEAC PIC X.

* 10 CMTDTP-EL-DT-DEB-PER-CRP-CEAC PIC X(8).

10 CMTDTP-EL-DT-DEB-PER-CRP-CEAC PIC X(6).

05 CMTDTP-EL-CLE-SEG-RPCRPCRG-CEA.

10 CTMDTP-EL-CD-GAR-CRG-COCEAC PIC X(5).

05 EL-NO-SEQ-CLE-DTP-COCEAC.

07 EL-NO-SEQ-CLE-DTP-CO-NUMCEA PIC 9(5).

05 EL-PRI-COUR-APR-DTP-COCEAC PIC S9(7)V99.

05 EL-PRI-AJU-APR-DTP-COCEAC PIC S9(7)V99.

05 EL-CD-RAIS-TX-APR-DTP-COCEAC PIC X.

05 EL-DT-TX-APR-DTP-COCEAC PIC 9(8).

05 EL-PRI-COUR-ENC-DTP-COCEAC PIC S9(7)V99.

05 EL-PRI-AJU-ENC-DTP-COCEAC PIC S9(7)V99.

05 EL-CD-RAIS-TX-ENC-DTP-COCEAC PIC X.

05 EL-DT-TX-ENC-DTP-COCEAC PIC 9(8).

05 EL-MT-TX-PRI-EXO-DTP-COCEAC PIC S9(7)V99.

05 EL-MT-TX-PRI-DIVD-DTP-COCEAC PIC S9(7)V99.

05 EL-MT-ORIG-CHQ-DTP-COCEAC PIC S9(7)V99.

05 EL-DT-RECEP-CHQ-DTP-COCEAC PIC 9(8).

05 EL-PRI-ENC-PRV-NON-GAG-DTP-CEA PIC S9(7)V99.

05 EL-MT-TX-COR-AJU-DTP-COCEAC PIC S9(7)V99.

05 EL-MT-TX-COR-PRI-DTP-COCEAC PIC S9(7)V99.

procedure division.

exit program.

11) After Rebuilding this program, right mouse click on ascii-layout.cbl and create new layout.

12) Right mouse click on 01 SEG-RPCMTDTP-CEAC and click on New layout.

13) Layout window will appear,

On left hand side, Scroll down to group item 01 SEG-RPCMTDTP-CEAC

Right mouse click and select New Layout

Default layout, click Next

Click Finish

Do a File -> Save as

Change File name to ASCII-layout.str and save the file.

Now ready to use the Data Tools -> Convert utility.

Open the ebcdic_ascii_convert.app project.

On the left hand side , you should rebuild only the ebcdic-layout.cbl to ebcdic-layout.int

Only this program ebcdic-layout should be in generic debug build.

Update all dependencies , rebuild all.

First , convert the mainframe ebcdic file MainFrame-ebcdic.dat to a ascii file using

Tools-> Data Tools -> Convert in the Net Express ide.

[pic]

Enter the following:

Input file

Filename: MainFrame-ebcdic.dat

A window will appear, put in 153 for maximum record length.

Change character set from ANSI to EBCDIC

Character set conversion

Check Convert character set.

Since the MainFrame-ebcdic.dat file does not contain packed fields , do not

need To check “Record contains non-text items. If the file did contain non-

text items (packed decimal fields), then you would enter a structure file layout

for the file.

For New File

Filename: d:\ebcdic_ascii_convert\convert_to_ascii.dat

Click Convert.

The Convert utility will convert 58 records.

[pic]

Next, Will convert convert_to_ascii.dat (ascii)file back to a convert_ascii_backto_ebcdic.dat (ebcdic)file.

First delete everything in generic debug build.

Highlight and drag over to generic debug build the ascii-layout.cbl

Next, for the ascii-layout.cbl do Poject -> Update all dependencies, Project -> Rebuild all

Now, do the Tools-> Data Tools -> Convert

Enter the following:

Inputfile

Filename: d:\ebcdic_ascii_convert\convert_to_ascii.dat

Enter 153 for maximum record length.

Change character set from EBCDIC to ANSI.

Newfile

Change filename to d:\ebcdic_ascii_convert\convert_ascii_backto_ebcdic.dat

Click on Convert and 58 records will be converted.

Close the Project and files.

[pic]

The following files are now in the ebcdic_ascii_convert folder

1) Original mainframe ebcdic file: MainFrame-ebcdic.dat

2) Converted ascii file: convert_to_ascii.dat

3) Converted back to ebcdic file from ascii file: convert_ascii_backto_ebcdic.dat

The trick now is to use the appropriate Structure file (.str) depending on which file that is being viewed is either ASCII or EBCDIC.

For example,

Depending on the file being open, need to be in the correct structure file for ebcdic use ebcdic.str or for ascii use ascii.str.

First , load and rebuild in generic debug build the ascii-layout.cbl to ascii-layout.int

Open up the convert_to_ascii.dat file in the ebcdic_ascii_convert folder.

Do File ->Open

Change file of type to data file *.dat

Open the convert_to_ascii.dat with 153 maximum record length.

You can save a profile for this file if prompted.

[pic]

NOTE:

When opening up one of the data files , and the following ******** appear in the value fields then either the structure file (.str ) was created wrong or the wrong structure file was used to convert , then delete the data file and load the appropriate cobol program and rebuild one for ebcdic (ebcdic-layout.cbl) or one for ascii (ascii-layout.cbl) before converting the file. Make sure update all dependencies, rebuild all in the project before converting.

Also, 2 projects can be created for the layouts , one for ascii layout and another for ebcdic layout.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download