RES – A Pure Java Open Source COBOL To Java Translator

  Support This Project" /></span><span style='mso-bookmark:
    main'></span></a><span style='mso-bookmark:main'><span class=MsoHyperlink><span
    style='color:windowtext;text-decoration:none;text-underline:none'><o:p></o:p></span></span></span></p>
    <p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:
    auto;line-height:normal;mso-outline-level:2'><span style='mso-bookmark:
    main'></span><a href=  

What is RES?

How to work with RES?

When did RES start?

Who develops RES? 

What is supported?

Notes on performance

Command Line Help

News Archive

User Views

Thanks for your reply and for a wonderful tool…

-Jimmy Jonsson, Sweden

Thanks for this project. It provides a very high degree of success in converting our MF Cobol programs to maintainable Java programs which I see as a great advancement over the OpenCobol project as the converted cobol code is maintainable. I am looking forward to being able to implement this into the workplace. 

– Jim Nicholls, Australia

..The tool is surely a wonderful tool and will be very useful in my current project… 

- Lakshmishankar, USA

I am experimenting with your great tool RES…

- Yilmaz KOCAK

 

Current Events

08/01/2010

Uploaded a New Version of RES.

Good stuff in this upload are:

·          Bug-fixes making RES more stable

·          Powerful command line feature to process a list of files or a wild-card.

Hope to have more coming soon…

What is RES?

RES is a tool which translates COBOL language programs to target Java language programs.

RES will attempt 100% translation but some re-factoring of the target Java may be recommended.

RES is designed to generate maintainable Java code.

RES generated Java code can have performances close to native Java.

RES is in pre-Beta with the following COBOL features and more coming soon.

RES is Open-Source and available at: sourceforge.net

RES is developed in pure Java with JDK, JTB and JAVACC

RES is developed incrementally

 Top

 

How to work with RES?

Download RES.

Unzip the RES.zip to a clean directory.

Install Sun Java JRE or JDK if necessary

         Translate the sample programs in COBOL\ folder and view the target Java before going further

Type from a command prompt (Under Windows: Start Run cmd.exe)

          To Translate a COBOL Program:

            Java –jar RES.jar COBOL\<source-file-name>

To Translate a fixed format COBOL program (default):

            Java –jar RES.jar -fixed COBOL\<source-file-name>

To Translate a free format COBOL program:

            Java –jar RES.jar -free COBOL\<source-file-name>

To run Preprocessor: (See if output is formatted cleanly to choose between free/fixed formats)

            Java –jar RES.jar -e COBOL\<source-file-name>

To Output COBOL statements as comments in Java:

            Java –jar RES.jar –c1 COBOL\<source-file-name>

To Output the COBOL comments in Java:

            Java –jar RES.jar –c2 COBOL\<source-file-name>

To Output COBOL statements as comments and the COBOL comments in Java:

            Java –jar RES.jar –c3 COBOL\<source-file-name>

To use Java native types instead of CobolBytes stream for data whenever possible: (Look in RES Timings)

            Java –jar RES.jar –javatype COBOL\<source-file-name>

To use Java native types instead of CobolBytes stream for all data but FILLERs: (Look in RES Timings)

            Java –jar RES.jar –javatype2 COBOL\<source-file-name>

To force use of CobolBytes stream for all data:  (Look in RES Timings)

            Java –jar RES.jar –nojavatype COBOL\<source-file-name>

To get the help on all the options:

                Java –jar RES.jar

Combine command line options above.

          Command line options override defaults set in Config.properties file.

          To compile with Javac and to run with Java use option: –cp .;RES.jar

 Top

 

When did it start and what is the plan?

          Started Coding in March, 2009.

          Planned releases for complete VS-COBOL in early 2010.

 Top

 

Who?

          Venkat open.cobol.to.java@gmail.com

 Top

 

Pre-Beta Features

 Available

Restrictions

Accept

Compilable code only in all cases

Display

Compute/ Add/Multiply/Subtract/Divide

Go To

 

Perform

If

 

Move

 

Call

EVALUATE

INSPECT

INITIALIZE

SET

Data levels with Accessors

Sequential files

Indexed and VSAM files

File data has to be migrated to RDBMS tables. Migration support provided.

EXEC SQL support

SQL and stored procedure CALLs

Top

RES Timings with the different Java Data Type Options  

 Benchmark Program - COBOL\Bubble-Sort2.cob

Simple bubble sort algorithm sorting a 10240 size array (OCCURS 10240) of a data-group (no PIC) containing 3 elements (with valid PICs). The array is loaded in descending order with negative numbers (-1,-2,-3…,-10240) and positive numbers (1,2,3…,10240). The array is sorted using two typical for (PERFORM… TIMES) loops over the array. A swap is done if the elements are out-of-order inside the inner loop after testing using an if (IF) statement. The important thing to be noted here is that the swapping is done only if the elements are out-of-order and the swapping is the only COBOL group-level access (MOVEs) in the entire benchmark. All other statements access directly the elements with PIC. So, if the array is already in sorted order, no swapping will be done and hence no group-level operation.

Timings with options –nojavatype, -javatype and –javatype2

Description/Option Timing ms

-nojavatype OR -opt0

-javatype OR -opt1

-javatype2 OR -opt2

Descending order Input

160375

56578

664909

Ascending order Input

88844

30203

8656

What does it all mean?

Note that of all the timings, for both types of inputs, the maximum and the minimum times are in the option –javatype2. This option uses native Java types for all element data except FILLERs. This constructs/stores the groups from/to element data on the fly. The second timing, sorted input, for –opt2 has amazingly small value because it does not do any group access, it does only element data access which is optimized as a native Java data access. So use this option if you are sure that the logic of the input program does mostly element level access or can be altered easily to do so. This is also the case if you decide to refactor all group access in COBOL using Java SE classes and methods, which may be a worthwhile effort. The Ascending order Input timing, above, for –javatype2 option compares well with timings of a hand coded Java class. As must be apparent from the above table, refrain from using –javatype2 for programs using a lot of group level data access.

The next best timings are with option –javatype which attempts to use native Java types as much as possible without constructing/storing groups on the fly. This is the best choice to use without eliminating group level data access in source COBOL and in target Java.

The option –nojavatype though has the worst timing should not be ignored as this might be the best choice while reading/writing to sequential files (not databases), which may be available soon.

Disclaimer: RES is open-source software provided under GPL license without any warranty. The above timings are not meant to be an implication of warranty or anything of that sort. The benchmark Java classes are provided in the TEST folder in RES.jar file.

Top

Command Line Options Help

Usage: java -jar RES.jar [options] <Source-File-Name>

 

Options for COBOL translation may one or more of the following.

 

        -dp package-name: spcifies the package for data classes.

        -pp Package-Name: spcifies the package for program classes.

 

        -dp0            : creates packages like "coboldataclasses".

        -dp1            : creates packages like "coboldataclasses.programname".

 

        -fixed          : fixed source format

        -free           : free/variable source format

 

        -e              : run only preprocesser.

        -p              : run only preprocesser and parser

 

        -c0             : target Java files contain no Cobol comments.

        -c1             : print Cobol statements in comments.

        -c2             : retain Cobol comments.

        -c3             : retain Cobol comments and statements in comments.

 

        -nojavatype

        -opt0           : force use  of CobolBytes stream.

 

        -javatype

        -opt1           : use native Java types whereever possible.

 

        -javatype2

        -opt2           : use native Java types for all. enables cache.

        -allsym         : translate all symbols including not REFeferenced or MO

Dified.

        -gendb          : generate db migration classes for ISAM/VSAM files.

        -nogendb        : suppress generation of db migration classes.

        -v              : verbose output.

These options override the defaults in Config.properties file.

OR

Usage: java -jar RES.jar -dbmigrate [options]

Options for VSAM/ISAM Migration may be one or more of the following.

        -dp Package-Name: spcifies the package for program classes.

            Default package is coboldataclasses.db_gen from translation.

        -file File-name: specifies the COBOL FD name for VSAM/ISAM file.

            Default is  all files generated from translation.

        -data File-name: specifies the sequential file with VSAM/ISAM data.

            Default is ASSIGN name of generated file.

        -readback       : read back from DB and compare for validation.

These options use DB configuraion in RunConfig.properties file.

Top

News Archive

07/14/2010

Uploaded a New Version of RES.

Good Stuff in this upload are:

Display usage numbers have String getters and setters generated.  

Index files have a simpler and more efficient database table schema.

Alternate keys available and tested in index files schemas

Refinements to MOVE algorithm and more…

06/16/2010

No more uploads planned for the month, RES.jar available on request…

Indexed file syntax supported with JDBC based relational tables

Most NIST tests on indexed files PASS with the following syntax exceptions

       File status codes

       Tweaks for START statements may be required

Plans for the near future include

       Relative files support as relational tables

       Completion of Intrinsic Functions

       SORT-MERGE

       DECLARATIVE for debugs

With the completion of above features, most COBOL-85 syntax would be successfully translated…

      Including all of EXEC SQL…

06/03/2010

Uploaded a New Version of RES.

Added in this version are:

        ALTER Statement support

        ENTRY Statement support

        Many support changes and fixes.

05/31/2010

Uploaded a New Version of RES.

Events in this release are:

            All (419) translated NIST test-cases compile without compilation errors.

            IX*.COB functional test starts to pass.

           Many support changes and fixes.

05/23/2010

Uploaded a New Version of RES.

Good stuff in the release are:

        NIST test-suite IF*.COB and IC*.COB functional tests PASS.

        Most of Intrinsic Functions available

        INDEX(ALL) and DEPENDING ON support implemented

         Search Statement

         Unstring Statement

          Bug Fixes.

05/01/2010

Uploaded a New Version of RES.

Linux support tested for the first-time on CentOS 5.4

Support for non-Latin characters in Cobol words

04/25/2010

Uploaded a New Version of RES.

Uploaded NIST TEST Suite. 417/461 programs translated for RES features.

Focus this week is to make RES robust and functionally equivalent in NIST tests.

Any of you Cobol or Java experts, willing to contribute to RES, please contact me.

04/18/2010

Uploaded a New Version.

RES development back to activity after sometime…   been on a vacation AND exercising RES against NIST test-suite.

Excited at the results of NIST tests… Hope to publish the results next-week.

Keep the bugs and feature requests coming.

03/26/2010

Uploaded a New Version.

Reworked Section class.

Added _Math class

COPY REPLACING and REPLACE implemented.

And much more…

03/25/2010

Upload towards the end of day EST USA.

Check out the NIST test results for Nc176a.java, which has lots of arithmetic, rounding, ON SIZE and NOT ON SIZE etc.

Also checkout test results for Sm201a.java and Sm202a.java. This test contains quite complex COPY…REPLACING.

03/20/2010

No Upload this week due to other priorities.

RES continues to prove in NIST functional tests.

Keep the bugs and feature requests coming.

03/14/2010

Uploaded a New Version.

Translates 355/393 of NIST Test-Suite for RES features.

Starts proving in NIST functional tests.

Many Important Bug fixes and Enhancements.

03/07/2010

Uploaded a New Version.

Translates 351/393 of NIST Test-Suite for RES features.

Many Important Bug fixes and Enhancements.

02/28/2010

Uploaded a New Version.

Bug fixes and Enhancements of Existing Features

02/22/2010

Uploaded a New Version.

Supported in this version:

VSAM/ISAM File COBOL verbs implemented with SQL/JDBC

VSAM/ISAM Files to Relational Database Migration utility

Documentation for VSAM/ISAM support coming in the next few days

New verbs EVALUATE, complete INSPECT

Bug Fixes

RES is the most relevant project in Sourceforge for search in COBOL and JAVA.

RES downloads in the last six months has crossed 425

02/22/2010

Uploaded a New Version.

EXEC SQL refinements and bug fixes.

SET statement

See forum for all fixes and enhancements.

02/14/2010

Uploaded a New Version.

Call verb supported including pass by reference.

JDBC CallableStatement support in EXEC SQL EXECUTE.

INOUT Parameter in EXEC SQL EXECUTE

INTO clause in SQL queries supported

EXEC SQL CONNECT support for Oracle style connects.

Many bug fixes.

02/07/2010

Check out VALIDATE-EXEC-SQL.COB. Translate and run. Tested under Oracle.

02/04/2010

New translation of SQL with OO features coming this week-end. See sample Java

01/30/2010

Uploaded New version.

More NIST test-suite programs (235/393) parsed and translated for RES features.

Tested with NIST test-suite and fixed many bugs.

Tested successfully Dynamic SQL translation and execution.

Option –dp1 to create data packages with name like coboldataclasses.programname.

Implemented most of the Intrinsic Function Library.

(Note: If anyone can add unimplemented functions to CobolFunctions class, kindly send code)

A File to Database Conversion Tool is in the works.

01/24/2010

                Uploaded a new version.

                EXEC SQL INCLUDES supported in the preprocessor.

                Nested copies and Program Units parsed correctly.

                EXEC SQL support for dynamic PREPARE, DECLARE and FETCH.

See COBOL and Java Program and Data Access Object.

                EXEC SQL support for indicator variables.

                EXEC SQL Statements translated more correctly.

                Non COBOL-85 features 78 level and PIC X… VARYING supported on request.

                Intrinsic FUNCTIONs now parsed correctly.

                Sequential FILE support started.

                Bug Fixes.

01/15/2010

            UPLOADED a new significant version.

Option -JavaType2 introduced to dramatically improve execution speed for some cases.  (Look in RES Timings)

 Laid a good framework for quick addition of functions in future

Major re-factoring of Symbol Table and Cobol-2-Java classes

Translation Table introduced for expressions

Test-suite automation done in good part

Significant number of NIST and other test cases translated successfully

Many bug fixes

Benchmark and timings created

01/12/2010

UPLOAD OF NEW VERSION IN THE NEXT FEW DAYS.

                RES has had more than 200 downloads. Request to users to report bugs.

12/16/2009

Coming soon EXEC SQL support. Look at the samples COBOL and Java Program and Data Access Object.

Note that this is a work-in-progress being less than 15 days in development. See project forum post.

Changes:

Changes in the period ending January 30, 2010

More NIST test-suite programs (235/393) parsed and translated by RES.

Tested with NIST test-suite and fixed many bugs.

Tested successfully Dynamic SQL translation and execution.

Option –dp1 to create data packages with name like <coboldataclasses>.<programname>.

                Implemented most of the Intrinsic Function Library.

Changes in the period ending January 24, 2010

            EXEC SQL INCLUDES supported in the preprocessor.

                Nested programs and Program Units parsed correctly.

                Included EXEC SQL support for dynamic PREPARE, DECLARE and FETCH.

                Included EXEC SQL support for indicator variables.

                EXEC SQL Statements translated more correctly.

                Non COBOL-85 features 78 level and PIC X… VARYING supported on request.

                Intrinsic FUNCTIONs now parsed correctly.

                Sequential FILE support started.

Changes in the period ending January 16, 2010

Option -JavaType2 introduced to dramatically improve execution speed for some cases

Major re-factoring of Symbol Table and Cobol-2-Java classes.

                Symbol Tree visitor. CalculateLength and PrintSymbol classes are excecuted with the visitot.

                Common symbol conditions encapsulated in SymbolProperties

                Reworked symbol printing methods into smaller methods with name indicating the function.

Translation Table introduced for expressions.

                Laid a good framework for quick addition of functions in future.

                Conversion and arithmetic operations of ADD, SUBTRACT,MULTIPLY, DIVIDE.

Testsuite automation done in good part.

Significant number of NIST and other test cases translated successfully.

Uploaded Java sources and JavaCC files, now compile successfully with src/build.xml

                Many bug fixes.

                Benchmark and timings created.

Changes in the period ending December 15, 2009

            EXEC SQL support

            88 levels

            Library enhancements

            Many small enhancements

            Re-factoring of the source

            Bug fixes

            More test Cobol programs in cobol/

            First major run against NIST testsuite

            Runtime properties (RunConfig.properties) separated from translation properties (Config.properties)

Changes in the period ending October 12, 2009

            Byte array for groups instead of String

            Compare functions in Program

Significant performance improvement in Bubble-Sort.

Check out test programs in /test. Diff these with generated BubbleSort

Changes in the period ending September 28, 2009

            Groups in –JavaType option now has valid data

            Fillers stored and accessed correctly

            CobolBean to encapsulate all 01 data levels

            CobolBytes modified to work with CobolBean

            CobolBean to encapsulate Program level data also

            Untested –proc1 option implemented

            Started implementation of INSPECT

Changes in the week ending September 13, 2009

            Completed and tested most of PICTURE editing. Checkout TestPicture.java

            Move statement

            Bug Fixing

Changes in the week ending September 8, 2009

            Annotations with source file, begin line, begin column for COBOL Statements printed as comments.

            Cleanup of format of COBOL Statements printed as comments

            Enhancements and bug-fixes for dead-code removal

            Option to retain COBOL comments

Changes in the week ending August 30, 2009

Subscripting bug-fixes

REDEFINES

VALUE/Initialization

Use of Native Java types as a choice over CobolBytes stream

            Refactoring

            Miscellaneous Bug fixes

Changes in the week ending August 23, 2009

Preprocessor bug fixes

Implemented continuation lines

Parser bug fixes

Perform Varying refinements

Subscripting/OCCURS

Section

Better translation of Perform and Go To

On Size Error translation as ArithmeticException