Parameterization Example

The example below illustrates how Component Maker generates parameterized slices. Consider a COBOL program that contains the following structures:

WORKING-STORAGE SECTION.
  01 A
    03 A1
    03 A2
  01 B
    03 B1
    03 B2
    03 B4

Suppose that only A1 has been determined by Component Maker to be an input parameter, and only B1 and B2 to be output parameters. Suppose further that the component is extracted with input and output data structures that use the default names, BRE-INP-INPUT-STRUCTURE and BRE-OUT-OUTPUT-STRUCTURE, respectively, and with the default Optimization options set. The component contains the following code:

WORKING-STORAGE SECTION.
  01 A
    03 A1
    03 A2
  01 B
    03 B1
    03 B2
    03 B4
LINKAGE SECTION.
  01 BRE-INP-INPUT-STRUCTURE
    03 BRE-I-A
      06 BRE-I-A1
01 BRE-OUT-OUTPUT-STRUCTURE
    03 BRE-O-B
      06 BRE-O-B1
      06 BRE-O-B2
PROCEDURE DIVISION
  USING BRE-INP-INPUT-STRUCTURE BRE-OUT-OUTPUT-STRUCTURE.
BRE-INIT-SECTION SECTION.
  PERFORM BRE-COPY-INPUT-DATA.
  ........................
  ....(Business Logic)....
  ........................
  *COBOL Analyzer added statement
  GO TO BRE-EXIT-PROGRAM.
BRE-EXIT-PROGRAM-SECTION SECTION.
  BRE-EXIT-PROGRAM.
    PERFORM BRE-COPY-OUTPUT-DATA.
    GOBACK.
BRE-COPY-INPUT-DATA.
  MOVE BRE-I-A TO A.
BRE-COPY-OUTPUT-DATA.
  MOVE B TO BRE-O-B.