This discussion is archived
3 Replies Latest reply: Feb 24, 2011 6:29 AM by wkobargs RSS

Language Migration - COBOL to JAVA converion - Help required in mapping ???

842438 Newbie
Currently Being Moderated
Hi All, Im looking for an idea or suggestion on the COBOL group variable conversion to equivalent conversion approach in Java equivalent:

Background: The conversion tool currently im working on demands the tool to convert COBOL programs to .NET platform wherein all COBOL code needs to have an equivalent code in JAVA language. Inspite of find almost all the equivalent, I'm currently stuck in COBOL group variable declaration and redefine feature of COBOL equivalent in C# and Java programming.

Example:
I have a COBOL code as follows:

This is a COBOL declaration which occupies 30 bytes in memory. I'm looking for an equivalent declaration in JAVA program. The point to be noted here is the group variable at 01 level WS-NAME represents all the 30bytes on the whole whereas the sub level variables within the group (05 levels) can be used in the program individually representing 10 bytes each of their own.

The problem spans more when I have multiple redefines as mentioned below
01 WS-NAME
05 WS-FIRST-NAME
07 WS-TITLE PIC X(2).
07 WS-FNAME PIC X(8).
05 WS-MIDDLE-NAME PIC X(10).
05 WS-LAST-NAME
07 WS-SURNAME PIC X(8).
07 WS-SUFFIX PIC X(2).

Please note that the program can use any of the individual variables declared here in and the group variables of the higher level will be able to access them as a whole.
Example:
MOVE 'MR' TO WS-TITLE.
MOVE 'ALFRED' TO WS-FNAME.
MOVE 'ALEX' TO WS-MIDDLE-.
MOVE 'SANDOU' TO WS-SURNAME.
MOVE 'JR' TO WS-SUFFIX.

DISPLAY WS-NAME ==> will display MR ALFRED ALEX SANDOU JR.
DISPLAY WS-FIRST-NAME ==> will display MR ALFRED
DISPLAY WS-LAST-NAME ==> will display SANDOU JR.
DISPLAY WS-SUFFIX ==> will display JR.

Any changes to the above variables of any level will change the entire group accordingly..
e.g.: MOVE 'SR' TO WS-SUFFIX and DISPLAY WS-LAST-NAME ==> will display SANDOU JR and DISPLAY WS-NAME ==> will display MR. ALFRED ALEX SANDOU SR.

This problem spans more when I have a group redefine.
01 WS-RNAME REDEFINES WS-NAME.
05 WS-RFNAME PIC X(15).
05 WS-RLNAME PIC X(15).

In Redefines with COBOL both the variables share the same memory and hence the changes to the WS-RNAME in the given example actually changes the WS-NAME values and vice versa.

Example:
DISPLAY WS-RNAME ==> in the current scenario will display MR. ALFRED ALEX SANDOU SR.
MOVE 'ALFRED' TO WS-RFNAME.
MOVE 'SANDOU' TO WS-LNAME.
DISPLAY WS-RNAME ==> will display ALFRED SANDOU
DISPLAY WS-NAME ==> will also display ALFRED
SANDOU
Basically both share the same memory location and changes to any of the field in the program gets replicated on the usage of other variable. This happens implicit in COBOL as we have a two named memory location for the same memory location of 30 bytes. I'm looking for an equivalent in JAVA programming.

NOTE :
1. The changes are expected to be handled implicitly. No explicit assignment is entertained whenever a change happens to any of the variables belonging to the group.
2. There is a possibility of having more multiple redefines and more multiple sub grouping allowed in COBOL which makes the problem more tougher.

Please help me on this. Having different classes declared and assigning objects to each class will not help as whenever a change happens to any field will require an explicit way of calling get() or set() methods every time. I'm looking for an implicit change to happen like COBOL.
  • 1. Re: Language Migration - COBOL to JAVA converion - Help required in mapping ???
    wkobargs Journeyer
    Currently Being Moderated
    Hello,

    this forum is dedicated for migrations of non-Oracle databases to Oracle.

    I don't even see any correlation in your question to Oracle at all. Therefore I can't advise you to visit any other Oracle forum.

    Did you try already to google for "conversion cobol java mapping" ? That returns for me a lot of sources that might help you further.

    Regards
    Wolfgang
  • 2. Re: Language Migration - COBOL to JAVA converion - Help required in mapping ???
    842438 Newbie
    Currently Being Moderated
    Hi,

    My sincere apologies for using the wrong forum. I thought Migration includes both database and application. Application as an COBOL-DB2 to JAVA-ORACLE DB conversion which includes both database and Language part. Googling on this topic didnt helped me hence started reaching the forums. If you can suggest a forum for posting this JAVA question (recently tied searching for java and landing in oracle related sites) even that you would of great help..

    Sorry for the trouble..thanks..Alfred
  • 3. Re: Language Migration - COBOL to JAVA converion - Help required in mapping ???
    wkobargs Journeyer
    Currently Being Moderated
    Hello,

    thank you for making this clearer. DB2 was not mentioned in your initial text.

    The database migration from DB2 to Oracle can be done with the Oracle SQL Developer Migration Workbench. Including stored procedures in DB2. But we don't automate to migrate a Cobol application in DB2 to a Java application in Oracle.

    There are several Java forums - http://forums.oracle.com/forums/category.jspa?categoryID=285 -, but I can't tell whether any of them would be the right one to place your question.

    Have you searched already for 3rd party tools? I found this one, perhaps it is interesting for you: http://www.freesoftus.com/en/DB2/

    Regards
    Wolfgang

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points