Mainframe COBOL to Java, C# & Cloud

Run the Java Translation of AWS Card Demo

The AWS Card Demo is a simple mainframe COBOL/CICS application developed by the Amazon AWS team to showcase various modernization techniques.
We used the SoftwareMining Translation tool to convert the Card Demo's CICS COBOL code into both Java and C# versions.
The Java translation is hosted on the AWS Cloud and is accessible below:


Run the Java translation of AWS Card-Demo



SoftwareMining Automatic Conversion to Java Highlights:


AWS Card Demo: COBOL, Java, and C# Side-by-Side Comparison

This section presents a comparison of a COBOL paragraph and its translations into Java and C#. The sample, taken from the program "COBIL00C", demonstrates how the ACCOUNT-RECORD data structure used in the CICS READ operation is refactored into Object-Relational classes. It also showcases the transformation of CICS/BMS fields into Java Field objects, enabling operations like setFocus(), "setProtected", and more. For more details, refer to our guide on BMS Program Cleanup.

Below is a comparison of a COBOL paragraph with its Java and C# translations from the program "COBIL00C".

The sample demonstrates the refactoring of the ACCOUNT-RECORD data structure used in CICS READ into Object-Relational classes, and the transformation of CICS/BMS fields into Java Field objects, which support operations like setFocus() and "setProtected".
For more information, see our detailed guide on BMS Program Cleanup.

READ-ACCTDAT-FILE.

 EXEC CICS READ
   DATASET   (WS-ACCTDAT-FILE)
   INTO      (ACCOUNT-RECORD)
   LENGTH    (LENGTH OF ACCOUNT-RECORD)
   RIDFLD    (ACCT-ID)
   KEYLENGTH (LENGTH OF ACCT-ID)
   UPDATE
   RESP      (WS-RESP-CD)
   RESP2     (WS-REAS-CD)
 END-EXEC

 EVALUATE WS-RESP-CD
  WHEN DFHRESP(NORMAL)
      CONTINUE
  WHEN DFHRESP(NOTFND)
   MOVE 'Y'     TO WS-ERR-FLG
   MOVE 'Account ID NOT found...' TO
                   WS-MESSAGE
  MOVE -1       TO ACTIDINL OF COBIL0AI
   PERFORM SEND-BILLPAY-SCREEN
  WHEN OTHER
   DISPLAY 'RESP:' WS-RESP-CD 'REAS:' WS-REAS-CD
   MOVE 'Y'     TO WS-ERR-FLG
   MOVE 'Unable to lookup Account...' TO
                   WS-MESSAGE
   MOVE -1       TO ACTIDINL OF COBIL0AI
   PERFORM SEND-BILLPAY-SCREEN
 END-EVALUATE.
   
private void readAcctdatFile () {
  accountRecord.assignKeyLength(
                      accountRecord.getAcctId().lengthOf());
  accountRecord.assignResponseCodeField(
                      variables.getWsRespCd());
  accountRecord.read();
  variables.setReasCd(accountRecord.getResponse2Code());
  
  
  if (variables.getWsRespCd() == CicsCodes.NORMAL) {
    ;
  } 
  else if (variables.getWsRespCd() == CicsCodes.NOTFND) {
    variables.setErrFlg("Y");
    variables.setMessage("Account ID NOT found...");
    cobil0ai.getActidin(). setFocus();
    sendBillpayScreen ();
  } 
  else {
    DisplayHelper.display(this, "RESP:" 
	+ variables.getWsRespCdAsStr() 
	+ "REAS:" + variables.getReasCdAsStr());
    variables.setErrFlg("Y");
    variables.setMessage("Unable to lookup Account...");
    cobil0ai.getActidin().setFocus();
    sendBillpayScreen ();
  }}
  ...
  
  
   
private void void ReadAcctdatFile (){
  accountRecord.AssignKeyLength(
                 accountRecord.AcctId.LengthOf());
  accountRecord.AssignResponseCodeField(
                 variables.WsRespCd);
  accountRecord.Read();
  variables.ReasCd = accountRecord.GetResponse2Code();
  
  
  if (variables.WsRespCd == CicsCodes.NORMAL))
  {
    ;
  } else if (variables.WsRespCd == CicsCodes.NOTFND)
  {
    variables.ErrFlg = "Y";
    variables.Message = "Account ID NOT found...";
    cobil0ai.Actidin.SetFocus();
    SendBillpayScreen ();
  } else
  {
    DisplayHelper.Display(this, "RESP:" + variables.WsRespCd 
	   + "REAS:" + variables.ReasCd);
    variables.ErrFlg = "Y";
    variables.Message = "Unable to lookup Account...";
    cobil0ai.Actidin.SetFocus();
    SendBillpayScreen ();
  }
}


   


Additionally, below are snapshots of BMS files translated into JSP/HTML. These represent the design-time views, rendered as HTML files. During runtime, the display will be in JSP for Java-translated applications and in HTML for those converted to C#/.NET.

BMS (mapset) File 'Cocrdup.bms' map 'CCRDUPA'

AWS CardDemo Mapset Cocrdup map CCRDUPA

BMS (mapset) File 'Coactup.bms' map 'CACTUPA'

AWS CardDemo Mapset Coactup map CACTUPA

For a hands-on experience, Test drive the Java AWS Card-Demo yourself.




  © 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.