Program Run Messages; Data Errors - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

Developing Compaq COBOL Programs
1.3 Developing Programs on OpenVMS Alpha
For more information about the OpenVMS Debugger, refer to Appendix C and the
OpenVMS Debugger Manual.

1.4 Program Run Messages

Incorrect or undesirable program results are usually caused by data errors or
program logic errors. You can resolve most of these errors by desk-checking your
program and by using a debugger.

1.4.1 Data Errors

Faulty or incorrectly defined data often produce incorrect results. Data errors can
sometimes be attributed to one or more of the following actions:
Incorrect picture size. As shown in the following sample of a partial program,
if the picture size of a receiving data item is too small, your data may be
truncated:
77
PROCEDURE DIVISION.
LOOP.
The IF clause will produce an infinite loop because of the one-digit size limit
of COUNTER, which is PIC S9. If COUNTER were PIC S99, or if the clause
used 9 instead of 10, the condition could be false, causing a proper exit from
the loop.
Incorrect record field position. The record field positions that you specify in
your program may not agree with a file's record field positions. For example,
a file could have this record description:
01 PAY-RECORD.
03 P-NUMBER
03 P-WEEKLY-AMT
03 P-MONTHLY-AMT PIC S9(5)V99 COMP-3.
03 P-YEARLY-AMT
Incorrectly positioning these fields can produce faulty data.
In the following example, a program references the file incorrectly. The field
described as P-YEARLY-AMT actually contains P-MONTHLY-AMT data, and vice
versa.
1–52 Developing Compaq COBOL Programs
COUNTER
PIC S9.
.
.
.
.
.
.
ADD 1 TO COUNTER
IF COUNTER < 10 GO TO LOOP.
PIC X(5).
PIC S9(5)V99 COMP-3.
PIC S9(5)V99 COMP-3.
.
.
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents