Mainframe COBOL to Java, C# & Cloud

Migrating IBM CICS/VSAM Data During COBOL to Java/C# Conversion

IBM Mainframe applications are renowned for leveraging the full spectrum of platform capabilities, from sophisticated transaction monitoring features to the efficient file storage and access provided by VSAM. This page delves into the intricacies of migrating Mainframe VSAM storage and associated APIs into Java-based solutions. Our goal is to simplify these complex systems for Java developers, enabling those without prior COBOL or CICS experience to easily understand and maintain the migrated code.

SoftwareMining's methodology for this transition is meticulously designed for maximum efficiency and clarity. During the translation phase, the system parses and analyzes the COBOL code before regenerating it as Java output. This process enables the system to refactor and reorganize the program logic, thereby generating Java code with better prospects for maintenance. A critical part of this process involves identifying and transforming 'DATA-DIVISION / WORKING-STORAGE' structures, especially those associated with CICS READ/WRITE operations, into equivalent Java constructs. For example, when the system encounters the CLIENT-RECORD structure being used in a CICS 'READNEXT' operation, it skillfully extracts this structure from the encapsulating 'WS-DATA' structure and converts it into the CICS CRUD-aware 'ClientRecord' Java class.

In this approach, the system utilizes the structure defined in COBOL's DATA-DEFINITION section to generate SQL tables (DDL) for the KSDS VSAM data file, defined by the CLIENT-RECORD structure. Meanwhile, the object-oriented nature of the generated ClientRecord Java class facilitates communication through SQL with the target database.



Example of Mainframe VSAM to Java Conversion

The following example demonstrates the translation of a Mainframe KSDS structure, CLIENT-RECORD, into Java code. It's noteworthy that the structure starting at a '05' level, instead of the typical '01' level, did not impact the clarity of the generated Java code.
  CICS COBOL 


  WORKING-STORAGE SECTION.
  01  WS-DATA.
  
    05  WS-TMP.
      10 LEN          PIC 9(9) VALUE 0.
      10 KEY          PIC 99V99 VALUE 0.
    ... 
    05 CLIENT-RECORD
      10 NAME               PIC X(20).
      10 ADDRESS            PIC X(20) OCCURS 3 TIMES.
      10 ID                 PIC 9(4) COMP.
  
    ...
  
  Generated Java 

 
 // Since 05 CLIENT-RECORD  is used in a CICS READNEXT operation,  
 // its definitions is removed from the encapsulating  WS-DATA 
 // structure and is refactored to its own Cics-Aware 
 // Object-Relational Data Access Object. 
  private ClientRecord clientRecord = new ClientRecord(this);
 
  // Meanwhile the fields and groups associated with Client-RECORD 
  // have been removed from WS-DATA. The DAO WsData only contains 
  // remaining fields/groups from original WS-DATA.
  
  private WsData data = new WsData(this);

  ...
	
     EXEC CICS
         READNEXT DATASET('CLIENT-FILE')
                  INTO(CLIENT-RECORD)
                  RIDFIELD(KEY)
                  LENGTH(LEN)

     END-EXEC

      ...  
    // New Cics aware DAO's will require same data
    // the key-value (search key) comes from WS-DATA structure
   clientRecord.assignKeyValue(wsData.getKey());
   
    // File-name is defunct in SQL, but info is not lost and 
    // it may be configured to used for 'tablename'
   clientRecord.assignFileName("CLIENT-FILE");
   
    // the SQL statement for reading the record using the key  
    // is generated iternally by the Object-Relational architecture
   clientRecord.next();
   
   ...   


Mainframe COBOL Migration Related Papers




  © 2024 SoftwareMining is a trademark of Software Modernization Technologies Ltd (UK). Registered in England company no: 07300248. Reg Offices: 79 Stevens House, Jerome Place, Kingston Upon Thames, KT1 1HX, United Kingdom.