COBOL-to-Java Translation Capabilities
CardDemo illustrates the runtime behavior of a complete application converted from COBOL
to Java. SoftwareMining's conversion tool also supports all complex language constructs,
packed-decimal arithmetic, data handling, transaction processing, and batch technologies
required for enterprise-scale COBOL portfolios.
CardDemo: COBOL, Java, and C# Side-by-Side
This side-by-side comparison (from program COBIL00C) demonstrates how the
ACCOUNT-RECORD used in CICS READ operations is mapped to
Object-Relational data classes, and how CICS/BMS fields become typed UI component objects
supporting methods such as setFocus() and setProtected.
See BMS Program Cleanup for technical details.
| COBOL |
Java |
C# |
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) {
// ok
} 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 ReadAcctdatFile() {
accountRecord.AssignKeyLength(accountRecord.AcctId.LengthOf());
accountRecord.AssignResponseCodeField(variables.WsRespCd);
accountRecord.Read()();
variables.ReasCd = accountRecord.GetResponse2Code();
if (variables.WsRespCd == CicsCodes.NORMAL)
{
// ok
}
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();
}
}
|
This implementation demonstrates clean object-relational mapping for ACCOUNT-RECORD
and automated translation of BMS screen fields into strongly typed UI properties.
Explore the complete technical guide: BMS Program Cleanup.