X hits on this document

320 views

0 shares

0 downloads

0 comments

85 / 120

30:

COMPUTE SI-RESULT = SI-OPERAND-1 + SI-OPERAND-2

31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43:

ON SIZE ERROR PERFORM HANDLE-SIZE-ERROR END-COMPUTE WHEN DO-SUB COMPUTE SI-RESULT = SI-OPERAND-1 - SI-OPERAND-2 ON SIZE ERROR PERFORM HANDLE-SIZE-ERROR END-COMPUTE WHEN DO-MUL COMPUTE SI-RESULT = SI-OPERAND-1 * SI-OPERAND-2 ON SIZE ERROR PERFORM HANDLE-SIZE-ERROR END-COMPUTE

44: END-EVALUATE 45: * Successful return

46:

MOVE MSG-SUCCESSFUL TO SI-RESULT-MESSAGE

47:

MOVE 2 TO RETURN-CODE

48:

GOBACK

49:

.

50: ****************************************************************** 51: ** Handle numeric overflow and end the program ** 52: ******************************************************************

53:

HANDLE-SIZE-ERROR.

54:

MOVE MSG-NUMERIC-OVERFLOW TO SI-RESULT-MESSAGE

55:

MOVE 16 TO RETURN-CODE

56:

GOBACK

57:

.

58:

END PROGRAM 'SMPLCALC'.

Looking at the source code for the COBOL program SMPLCALC.cbl, we can

easily determine the entry point name and the data layout of the I/O data structure.

However, even knowing the full details of the application's interface does not solve the

problem of making it easily reusable from Java or C because of the differences in the

language data type systems. For example, Packed Decimal (Computational-3) is a

numeric type that is commonly found in COBOL mainframe programs, but is not

directly supported in the Java and C/C++ languages. Even floating-point numbers can be

problematic because some COBOL compilers, including IBM's, do not use the standard

77

Document info
Document views320
Page views321
Page last viewedSun Dec 04 15:36:12 UTC 2016
Pages120
Paragraphs2913
Words25794

Comments