5.3 Extracting code for reuse

 < Day Day Up > 



You can use WSAA to extract specific lines of code to create a new compilable program. You can extract code only from a COBOL program if it has successfully completed the inventory collection process. When you extract a segment of code, select lines of code that other programs can use and that contain COBOL statements such as CALL or MOVE.

Two files are created when you extract code:

  • Code extract file, which contains the lines of code extracted from a COBOL program in your inventory.

  • Complement file, which contains the lines of code that were not extracted from the original COBOL program.

    Restriction: 

    The complement file is created only if you have selected one or more contiguous lines of code. If you select lines that are non-contiguous, WSAA is not able to create a complement file.

When the complement file is created, a COBOL CALL statement is added to invoke the code extract file. If the code extract file and the complement file are created without any errors, you can compile these two files and link each of them into load modules. When you invoke the complement module, it should perform the same function as the original COBOL program.

5.3.1 Extract code from TRADERB

To extract code from TRADERB, perform the following steps.

  1. On the Data element summary page that was shown in Figure 5-3 on page 143, click TRADERB. The Program detail page is displayed, as shown in Figure 5-8.

    click to expand
    Figure 5-8: Program details page for TRADERB

  2. Click Code extraction. The Code extraction page is displayed, as shown in Figure 5-9.

    click to expand
    Figure 5-9: Code extraction page, preliminary view

  3. If necessary, change the high-level qualifier of the output data sets to match your TSO user ID.

    Note 

    Pay particular attention to the note underneath these fields. You must pre-allocate these output data sets, otherwise WSAA will issue an error message.

  4. Scroll through your program to find the segment of code that can be used as a stand-alone process. In this example, we found the READ-CUSTOMER-FILE section was a suitable candidate.

  5. Select the text to highlight it, as shown in Figure 5-10.

    click to expand
    Figure 5-10: Code extraction page, with selected text highlighted

  6. Click the Process button. WSAA processes the information and displays the results in the Code extraction page, as shown in Figure 5-11.

    click to expand
    Figure 5-11: Code extraction page, after processing

  7. Log on to an OS/390 or z/OS system.

  8. Go to ISPF Option 3.4.

  9. Enter the names of your data sets using a format similar to the following:

    DNET998.*.COBOL
  10. Browse the contents of each output file.

    Note 

    Unfortunately, this function did not work for us on the DemoMVS system. We have reported the problem to WSAA Support. At the time this chapter was last reviewed, we were still awaiting a fix.

WSAA is supposed to create the two COBOL programs, with the appropriate heading in the extract file and the appropriate linkage section in the complement file.



 < Day Day Up > 



IBM Redbooks - Websphere Studio Asset Analyzer
Adobe InDesign CS2 @work: Projects You Can Use on the Job
ISBN: 067232802X
EAN: 2147483647
Year: 2004
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net