COBOL runtime error

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

COBOL runtime error

Postby cwseay » Fri May 03, 2019 1:27 pm

I think this is an error in my COBOL code. It compiles, runs, and executes fine. Here is the runtime error:
 To end the program, enter 0.
 To perform another calculation, enter 1.
 Enter investment amount (xxxxx).
 Enter number of years (xx).
 Enter yearly interest rate (xx.x).
 CEE3207S The system detected a data exception (System Completion Code=0C7).
          From compile unit CALC2000 at entry point CALC2000 at compile unit off
set +0000056E at entry offset +0000056E
           at address 0005B56E.
 Abend 0C7000 hex occurred processing command 'CALL    '.

Here is the source code:
identification division.

       program-id. calc2000.

       environment division.

       input-output section.

       data division.

       file section.

       working-storage section.

       01  user-entries.

           05  number-entered              pic 9        value 1.
           05  investment-amount           pic 99999.
           05  number-of-years             pic 99.
           05  yearly-interest-rate        pic 99v9.

       01  work-fields.

           05  future-value                pic 9(7)v99.
           05  year-counter                pic 999.
           05  edited-future-value         pic z,zzz,zzz.99.

       procedure division.


           perform 100-calculate-future-value
               until number-entered = zero.
           display "End of session.".
           stop run.


           display "----------------------------------------".
           display "To end the program, enter 0.".
           display "To perform another calculation, enter 1.".
           accept  number-entered.
           display "----------------------------------------".
           if number-entered = 1
               perform 110-get-user-values
               move investment-amount to future-value
               move 1 to year-counter
               perform 120-calculate-next-fv
                   until year-counter > number-of-years
               move future-value to edited-future-value
               display "Future value = " edited-future-value.


           display "Enter investment amount (xxxxx).".
           accept  investment-amount.
           display "Enter number of years (xx).".
           accept  number-of-years.
           display "Enter yearly interest rate (xx.x).".
           accept  yearly-interest-rate.


           compute future-value rounded =
               future-value +
                   (future-value * yearly-interest-rate / 100).
           add 1 to year-counter.

Here is the JCL:
//CALC1001 JOB 1,'A. STUDENT',NOTIFY=&SYSUID                            00010000
//**************************************************                    00020000
//* COMPILE COBOL PROGRAM                                               00030000
//**************************************************                    00040000
//STEP1 EXEC IGYWCLG                                                    00050000
//SYSIN  DD DSN=&SYSUID..LANG.SOURCE(CALC1000),DISP=SHR                 00060010
//COBOL.SYSLIB DD DSN=CEE.SCEESAMP,DISP=SHR                             00070007
//GO.SYSIN DD *                                                         00090006
//LKED.SYSLIB DD DSNAME=&LIBPRFX..SCEELKED,DISP=SHR                     00091011
// DD DSNAME=&LIBPRFX..SCEELKEX,DISP=SHR                                00092011
Posts: 15
Joined: Thu Oct 05, 2017 8:28 am
Has thanked: 4 times
Been thanked: 0 time

Re: COBOL runtime error


Re: COBOL runtime error

Postby NicC » Fri May 03, 2019 1:43 pm

Try entering 034 as your interest rate. The V in 99V9 is an implied decimal point not a real one.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 2884
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 129 times

Return to IBM Cobol


  • Related topics
    Last post