|
|
Data File
Conversion Generate COBOL Source Code http://www.simotime.com |
| When technology complements business | Copyright © 1987-2010 SimoTime Enterprises All Rights Reserved |
This document describes how to generate the COBOL source code for two programs. The first program will read an EBCDIC-encoded file and write an ASCII -encoded file. The data conversion will be performed by a second COBOL program that is called by the first COBOL program. Since the COBOL source code is COBOL/2 compliant it may be compiled and executed on an IBM Mainframe (z/OS or VSE), a Wintel platform (Windows and Micro Focus) or a UNIX platform (with Micro Focus).
Performing this task will also generate an HTML document that describes the record layout based upon the copy file definition of the record structure. The HTML document will provide field position within the record and field lengths (both logical which is based on the PIC and physical which is based on the COMP or COMP-3).
This example illustrates the following functions.
| 1. | Generate the COBOL source code for a callable program that will convert a record (at the field level) from EBCDIC encoding to ASCII encoding. |
| 2. | Generate the COBOL source code for an I/O program that will read an EBCDIC encoded file, call a program to convert the record and write to the ASCII encoded file. |
| 3. | Create the file of specifications to generate the I/O program. |
| 4. | Create and execute a command file to automate and document the process. |
Note: This module is part of The SimoPATH Series of training and reference materials. For more information refer to The Home Page for The SimoPATH Series.
Generating the COBOL source code to do the data file conversion is a two step process. The first step is to create the callable conversion program using the copy file as input. The second step is to create the I/O program using the specifications file as input.
The file conversion is accomplished by reading a record, converting the content of the record and writing a record to a new file. The record-level conversion is done at the field-level. The COBOL copy file that defines the structure of a record layout is used to generate the callable conversion program.
The following is the specifications file used in this session as input to create the I/O program. The statements in this files will be used to generate the source code that will read the EBCDIC encoded file and write the ASCII encoded file.
/Dialect C2 /progid ITKEKAC1 /sysut1 name=ITMGETDE org=Indexed recfm=variable rlen=512 klen=12 kpos=1 /sysut2 name=ITMPUTDA org=Indexed recfm=variable rlen=512 klen=12 kpos=1 * /transmode E2A /transcall ITME2AR1 * /END
The following is a brief description of the statements used in the preceding example.
| Statement ID | Description |
| /DIALECT | Generate COBOL source code that is COBOL/2 compliant. |
| /PROGID | This is the name of the program that will be used in the PROGRAM ID statement of the generated COBOL source code. |
| /SYSUT1 | Defines the properties for the input file |
| /SYSUT2 | Defines the properties for the output file. |
| * | An asterisk in position one denotes a comment statement. |
| /TRANSMODE | E2A - Translate form EBCDIC encoding to ASCII encoding A2E - Translate from ASCII encoding to EBCDIC encoding |
| /TRANSCALL | The name of the callable routine that will do record level data conversion as specified by the /TRANSMODE statement. |
Start Windows Explorer and from the Desktop item select the following.
| My Computer | ||||||||||
|
The following right-window-pane should be displayed. The "ItemE2Aexample.CMD" is the Windows command (.CMD) provided to run this job.
From Windows Explorer perform the following steps.
| 1. | From the left pane select the c:\DataMig1\CONVERTS directory. |
| 2. | From the right pane double-click on ItemE2Aexample.CMD to execute the process to generate the COBOL source code. |
Executing the preceding should have generated the following three items.
| 1. | A COBOL source member that performs the file I/O to read the EBCDIC-encoded file and write the ASCII-encoded file. This program contains a call to the second program that is generated to do the conversion of each record in the file. |
| 2. | A callable COBOL source member that performs the EBCDIC to ASCII conversion of a record at the field level. |
| 3. | An HTML member that documents the record layout based upon the COBOL copy file that defines the record structure. |
The COBOL source members may now be compiled and executed as part of a Mainframe Express or Net Express project on a Windows platform. The Cobol source members may be transferred to a UNIX platform to be compiled and executed using Micro Focus COBOL. The source members may be transferred to a mainframe (z/OS or VSE) to be compiled and executed.
The purpose of this is to describe how to generate the COBOL source code that will convert a data file from EBCDIC-encoding to ASCII-encoding.
Permission to use, copy, modify and distribute this software, documentation or training material for any purpose requires a fee to be paid to SimoTime Enterprises. Once the fee is received by SimoTime the latest version of the software, documentation or training material will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
SimoTime Enterprises makes no warranty or representations about the suitability of the software, documentation or learning material for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software, documentation or training material.
The Home Page for The SimoPATH Series is the starting point to view information about training sessions and learning materials available from SimoTime Enterprises.
The SimoTime Home Page is the starting point to review all the information available from SimoTime Enterprises.
The SimoZAPS Utility Program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.
The SimoREC1 Utility Program has the capability of generating a callable COBOL program that will do the conversion of a data string between EBCDIC and ASCII. The generated COBOL source code or the conversion tables may be viewed or modified to meet unique requirements. The generated program may be called by an I/O program generated by SimoZAPS.
This item will provide a link to an ASCII or EBCDIC translation table. A column for decimal, hexadecimal and binary is also included.
This document provides a quick summary of the File Status Key for VSAM data sets and QSAM files.
Check out The VSAM - QSAM Connection for more examples of mainframe VSAM and QSAM accessing techniques and sample code.
The hexadecimal dump of the parameter-buffer uses the same technique as describe in another SimoTime example that describes the dumping of a data string using COBOL. The name of the member that does the actual hexadecimal dump is called SimoDUMP. A copy file (PASSDUMP.CPY) is provided for defining the pass area.
You may view the complete list of examples at http://www.simotime.com/sim4dzip.htm and many are available as a SimoTime Z-Pack (a zip file package with sample source code, data and documentation).
Note: You must be attached to the Internet to download a Z-Pack or view the list.
Check out The SimoTime Glossary for a list of terms and definitions used in the documents provided by SimoTime.
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com
We appreciate your comments and feedback.
Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
| Return-to-Top |
| Copyright © 1987-2010 SimoTime Enterprises All Rights Reserved |
| When technology complements business |
| http://www.simotime.com |
| Version 06.01.06 |