SOLUTIONS TO REVIEW QUESTIONS:  Chapter 6  

Debugging Exercises

1. Yes. We cannot assume that the filler areas in the OUT-REC will be blank.


2. It would be more efficient to describe the output record in WORKING-STORAGE so that VALUES could be assigned to the fields.


3. a. A syntax error will occur because the receiving field is too small. $(4) accepts only three integer digits. (Not all compilers will actually flag this as a syntaxberror; on most systems, a compiler option is used tobspecify whether the compiler should look for this type of error).

    b. No syntax error, but the decimal digits will be truncated.

    c. No syntax error, but the receiving field only needs three Z’s to the left of the decimal point.

    d. No syntax error, but if the sending field contains all zeros, spaces will print.

    e. Depending on the compiler a warning-level syntax error may occur to indicate that the output is signed while the input is unsigned.

4. No syntax error, but initializing a report-item is a waste of time. Something will be moved to AMT6 anyway, so why bother to initialize the field?