From bloom-picayune.mit.edu!bloom-beacon!micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!cis.ksu.edu!mac Sat Nov  9 03:41:51 EST 1991
Article: 514 of alt.cobol
Path: bloom-picayune.mit.edu!bloom-beacon!micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!cis.ksu.edu!mac
From: mac@cis.ksu.edu (Myron A. Calhoun)
Newsgroups: alt.cobol
Subject: Re: COBOL to C?
Date: 8 Nov 91 14:09:35 GMT
Organization: Kansas State University
Lines: 48
Message-ID: <mac.689609855@depot.cis.ksu.edu>
References: <khjcumINN8te@cs.utexas.edu> <1218@rufus.UUCP>
NNTP-Posting-Host: depot.cis.ksu.edu

drake@drake.almaden.ibm.com (Sam Drake) writes:
>Sure, someone could write a translator.  Unfortunately, COBOL 
>uses a number of data types and concepts that C doesn't provide
>(like decimal arithmetic and record-oriented files), so you'd
>need some fairly hefty runtime library.  And some of the COBOL
>transfer-of-control constructs (PERFORM X THROUGH Y, GOTO., etc)
>are pretty interesting to get right.  But sure, it's doable.

>I am not aware of any such translators.

Maybe this bstract of a Ph.D. Dissertation from Kansas State University
will prove interesting:

   "The primary objective of this dissertation is to discuss the
    difficulties encountered in, and to explore possible solutions to,
    the task of automatically converting programs written in one HLL,
    COBOL, into programs written in another HLL, Ada, and still
    maintain readability.

   "This paper presents at least one set of techniques and algorithms
    to solve many of the problems that were encountered.  The
    differing view of records is solved by isolating those instances
    where it is a problem, then using the 'RENAMES; option of Ada.
    Several solutions to doing the decimal arithmetic translation are
    discussed.  One method used is to emulate COBOL arithmetic in an
    arithmetic package.  Another partial solution suggested is to
    convert the values to decimal-scaled integers and use modular
    arithmetic.  Conversion to fixed-point type and floating-point
    type are the third and fourth methods.  The work of another
    researcher, Bobby Othmer, is utilized to correct any unstructured
    code, to remap statements not directly translatable such as ALTER,
    and to pull together isolated code sections.  Algorithms are then
    presented to convert this restructured COBOL code into Ada code
    with local variables, parameters, and packages.  The input/output
    requirements are partially met by mapping them to a series of
    procedure calls that interface with Ada's standard input-output
    package.  Several examples are given of hand-translations of COBOL
    programs.

   "In addition, a possibly new method is shown for measuring the
    readability of programs."

--Myron.
-- 
# We preserve our freedoms using three boxes:  ballot, jury, and cartridge.
# Myron A. Calhoun, PhD EE; Associate Professor  (913) 539-4448 home
# INTERNET:  mac@cis.ksu.edu (129.130.10.5)      532-6350 work, 532-7353 fax
#      UUCP:  ...rutgers!ksuvax1!depot!mac       W0PBV @ K0VAY.KS.USA.NA


