9.2 Legacy Software Reengineering and Reuse Exercise Solution
This section gives a solution to the exercise given in Section 9.1. The details of
the solution are organized according to the steps of the exercise. Software requirements
to build and test the solution include: Sun's Java JDK SE V6, Microsoft Visual C++
Studio Express 2008, and Micro Focus Net Express v5.1 (COBOL).
Most of the source listings in this section are abbreviated, and some of the steps
are skipped. The complete source and binaries for he solution can be downloaded from
h t t p : / / r e v e r s i n g p r o j e c t . i n f o / r e p o s i t o r y . p h p ? f i l e I D = 9 _ 2 _ 1 .
1) Locate the interface data structure for SMPLCALC.cbl in the copybook (source include file) SMPLCALC.cpy. There is only one data structure in the copybook.
The interface data structure for SMPLCALC.cbl is located in SMPLCALC.cpy and is
named SMPLCALC-INTERFACE (see Table 9.2). COBOL data structures begin with a
level 01 declaration and are usually hierarchical but can be elementary.
Table 9.2. Interface data structure SMPLCALC-INTERFACE in SMPLCALC.cpy.
03: 04: 05: 06: 07: 08: 09:
02 SI-OPERAND-1 PIC S9(9) COMP-5. 02 SI-OPERAND-2 PIC S9(9) COMP-5. 02 SI-OPERATION PIC X.
88 DO-ADD VALUE '+'. 88 DO-SUB VALUE '-'. 88 DO-MUL VALUE '*'. 02 SI-RESULT PIC S9(18) COMP-5.
02 SI-RESULT-MESSAGE PIC X(128).
Input/Output data structure