This may be as basic as it comes but I need help calling a subroutine. I am a student so please dis-regard my ignorance. First let me give you some background so that maybe you can help me. The program that I am supposed to develop is quite simple. It requires 2 subroutines that do seperate calculations. I will include these programs along with the main program. Anyway, I am able to compile, build and execute the program with no errors but when the program writes the output, I do not get any of the calulations. I get the dollar signs, decimal points and even zeros but no numbers. I ran it through the debugger in animate mode, then checked the values after it ran through the call statements but they only showed question marks on called values. Then I stepped through the program manually but this time I got an internal debugger error,after which it closed the program.
Here is the main program call
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. PROGRAM3.
000030 AUTHOR. DAVID RIVERA.
000040
000050 ENVIRONMENT DIVISION.
000060 INPUT-OUTPUT SECTION.
000070 FILE-CONTROL.
000080 SELECT COMMREPINPUT-FILE ASSIGN TO SYSIN
000090 ORGANIZATION IS LINE SEQUENTIAL.
000100 SELECT COMMREPOUTPUT-FILE ASSIGN TO SYSOUT
000110 ORGANIZATION IS LINE SEQUENTIAL.
000120
000130 DATA DIVISION.
000140 FILE SECTION.
000150 FD COMMREPINPUT-FILE
000160 RECORD CONTAINS 67 CHARACTERS
000170 DATA RECORD IS COMMREPINPUT-RECORD.
000171
000180 01 COMMREPINPUT-RECORD.
000190 05 FILLER PIC X(6).
000200 05 CRI-CONTNUMB PIC 9(6).
000210 05 CRI-CONTOWNER PIC X(20).
000220 05 FILLER PIC X(25).
000230 05 CRI-NUMBCONTR PIC 9(2).
000240 05 FILLER PIC X(2).
000250 05 CRI-CONTCOST PIC 99V99.
000260 05 FILLER PIC X(2).
000270
000280 FD COMMREPOUTPUT-FILE
000290 RECORD CONTAINS 132 CHARACTERS
000300 DATA RECORD IS COMMREPOUTPUT-RECORD.
000310 01 COMMREPOUTPUT-RECORD.
000320 05 FILLER PIC X(1).
000330 05 CRO-CONTNUMB PIC ZZZZZ9.
000340 05 FILLER PIC X(2).
000350 05 CRO-CONTOWNER PIC X(20).
000360 05 FILLER PIC X(5).
000370 05 CRO-NUMBCONTR PIC Z9.
000380 05 FILLER PIC X(6).
000390 05 CRO-CONTCOST PIC $$$.99.
000400 05 FILLER PIC X(4).
000410 05 CRO-CONTRTOT PIC $$,$$$.99.
000420 05 FILLER PIC X(5).
000430 05 CRO-COMMISS PIC $$$$.99.
000440 05 FILLER PIC X(5).
000450 05 CRO-TOTCOST PIC $$$,$$$.99.
000460
000470 WORKING-STORAGE SECTION.
000480 01 WS-EOF-FLAG PIC X.
000490 01 WS-ARGUMENTS.
000500 05 WS-COMM PIC 999V99.
000510 05 WS-CONTRTOT PIC 9999V99.
000520 05 WS-TOTCOST PIC 99999V99.
000530 01 WS-ACCUMULATORS.
000540 05 WS-FNL-NUMBCONTR PIC 9999.
000550 05 WS-FNL-CONTRTOT PIC 9(6)V99.
000560 05 WS-FNL-COMM PIC 9(5)V99.
000570 05 WS-FNL-TOTCOST PIC 9(7)V99.
000580 01 HEADING-LINE1.
000590 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000600 05 FILLER PIC X(7).
000610 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000620 05 FILLER PIC X(7).
000630 05 FILLER PIC X(9) VALUE 'NUMBER OF'.
000640 05 FILLER PIC X(2).
000650 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000660 05 FILLER PIC X(4).
000670 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000680 05 FILLER PIC X(20).
000690 05 FILLER PIC X(5) VALUE 'TOTAL'.
000700
000710 01 HEADING-LINE2.
000720 05 FILLER PIC X(1).
000730 05 FILLER PIC X(6) VALUE 'NUMBER'.
000740 05 FILLER PIC X(10).
000750 05 FILLER PIC X(5) VALUE 'OWNER'.
000760 05 FILLER PIC X(8).
000770 05 FILLER PIC X(9) VALUE 'CONTRACTS'.
000780 05 FILLER PIC X(4).
000790 05 FILLER PIC X(4) VALUE 'COST'.
000800 05 FILLER PIC X(8).
000810 05 FILLER PIC X(5) VALUE 'TOTAL'.
000820 05 FILLER PIC X(5).
000830 05 FILLER PIC X(10) VALUE 'COMMISSION'.
000840 05 FILLER PIC X(7).
000850 05 FILLER PIC X(4) VALUE 'COST'.
000851
000870 01 TOTAL-LINE.
000880 05 FILLER PIC X(15) VALUE 'TOTAL CONTRACTS'.
000890 05 FILLER PIC X(1) VALUE SPACES.
000900 05 TL-FNL-NUMBCONTR PIC ZZZ9.
000910 05 FILLER PIC X(16) VALUE SPACES.
000920 05 FILLER PIC X(12) VALUE 'FINAL TOTALS'.
000930 05 FILLER PIC X(2) VALUE SPACES.
000940 05 TL-FNL-CONTRTOT PIC $$$$,$$$.99.
000950 05 FILLER PIC X(2) VALUE SPACES.
000960 05 TL-FNL-COMM PIC $$$,$$$.99.
000970 05 FILLER PIC X(2) VALUE SPACES.
000980 05 TL-FNL-TOTCOST PIC $$,$$$,$$$.99.
000990
001000 PROCEDURE DIVISION.
001010 PREPARE-COMMODREP-REPORT.
001020 OPEN INPUT COMMREPINPUT-FILE
001030 OUTPUT COMMREPOUTPUT-FILE
001040 MOVE "N" TO WS-EOF-FLAG
001050 READ COMMREPINPUT-FILE
001060 AT END MOVE "Y" TO WS-EOF-FLAG
001070 END-READ.
001080
001090 PERFORM WRITE-HEADING-LINE1.
001100 PERFORM WRITE-HEADING-LINE2.
001110 PERFORM UNTIL WS-EOF-FLAG IS EQUAL TO "Y"
001130 MOVE SPACES TO COMMREPOUTPUT-RECORD
001140 MOVE CRI-CONTNUMB TO CRO-CONTNUMB
001150 MOVE CRI-CONTOWNER TO CRO-CONTOWNER
001160 MOVE CRI-NUMBCONTR TO CRO-NUMBCONTR
001170 MOVE CRI-CONTCOST TO CRO-CONTCOST
001171 CALL 'CALCCOMMSUB'
001172 USING CRI-NUMBCONTR, CRI-CONTCOST, WS-ARGUMENTS
001173 END-CALL
001174
001175 MOVE WS-CONTRTOT TO CRO-CONTRTOT
001176 MOVE WS-COMM TO CRO-COMMISS
001177 MOVE WS-TOTCOST TO CRO-TOTCOST
001178 MOVE WS-TOTCOST TO CRO-TOTCOST
001179 CALL 'ACCTOTLSUB'
001180 USING CRI-NUMBCONTR, WS-COMM, WS-CONTRTOT, WS-TOTCOST, WS-FNL-NUMBCONTR, WS-FNL-CONTRTOT, WS-FNL-COMM, WS-FNL-TOTCOST
001181 END-CALL
001182 MOVE WS-FNL-NUMBCONTR TO TL-FNL-NUMBCONTR
001183 MOVE WS-FNL-CONTRTOT TO TL-FNL-CONTRTOT
001184 MOVE WS-FNL-COMM TO TL-FNL-COMM
001185 MOVE WS-FNL-TOTCOST TO TL-FNL-TOTCOST
001189 WRITE COMMREPOUTPUT-RECORD
001320 READ COMMREPINPUT-FILE
001330 AT END MOVE "Y" TO WS-EOF-FLAG
001340 END-READ
001350 END-PERFORM.
001361
001384 PERFORM WRITE-TOTAL-LINE.
001430 CLOSE COMMREPINPUT-FILE.
001450 CLOSE COMMREPOUTPUT-FILE.
001460 STOP RUN.
001470 WRITE-HEADING-LINE1.
001490 MOVE SPACES TO COMMREPOUTPUT-RECORD.
001500 WRITE COMMREPOUTPUT-RECORD.
001510 MOVE HEADING-LINE1 TO COMMREPOUTPUT-RECORD.
001520 WRITE COMMREPOUTPUT-RECORD.
001530
001540 WRITE-HEADING-LINE2.
001550 MOVE HEADING-LINE2 TO COMMREPOUTPUT-RECORD.
001560 WRITE COMMREPOUTPUT-RECORD.
001570 MOVE SPACES TO COMMREPOUTPUT-RECORD.
001580 WRITE COMMREPOUTPUT-RECORD.
001590
001600 WRITE-TOTAL-LINE.
001610 MOVE SPACES TO COMMREPOUTPUT-RECORD.
001620 WRITE COMMREPOUTPUT-RECORD.
001630 MOVE TOTAL-LINE TO COMMREPOUTPUT-RECORD.
001640 WRITE COMMREPOUTPUT-RECORD.
001650
Here is the first sub-routine
000010 IDENTIFICATION DIVISION.
000011 PROGRAM-ID. CALCCOMMSUB.
000012 AUTHOR. DAVID RIVERA
000013
000016 LINKAGE SECTION.
000018 01 LS-NUMBCONTR PIC 9(2).
000019 01 LS-CONTCOST PIC 99V99.
000021 01 LS-ARGUMENTS.
000022 05 LS-COMM PIC 999V99.
000023 05 LS-CONTRTOT PIC 9999V99.
000024 05 LS-TOTCOST PIC 99999V99.
000025
000026 PROCEDURE DIVISION USING LS-NUMBCONTR, LS-CONTCOST, LS-ARGUMENTS.
000028 COMPUTE LS-CONTRTOT = LS-NUMBCONTR * LS-CONTCOST
000030 IF LS-CONTRTOT <= 1000.00
000031 COMPUTE LS-COMM = LS-CONTRTOT * 0.7
000032 ELSE
000033 COMPUTE LS-COMM = (LS-CONTRTOT - 1000.00) * 0.5 + 70.00
000034 END-IF
000035 COMPUTE LS-TOTCOST = LS-CONTRTOT + LS-COMM
000036 END-COMPUTE.
000037 EXIT PROGRAM.
Here is the last sub-routine
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. ACCTOTLSUB
000030 AUTHOR. DAVID RIVERA
000040
000050 LINKAGE SECTION.
000051 01 LS-NUMBCONTR PIC 9(2).
000053 01 LS-COMM PIC 99V99.
000054 01 LS-CONTRTOT PIC 9999V99.
000055 01 LS-TOTCOST PIC 99999V99.
000056 01 WS-ACCUMULATORS.
000057 05 LS-FNL-NUMBCONTR PIC 9999.
000058 05 LS-FNL-CONTRTOT PIC 9(6)V99.
000059 05 LS-FNL-COMM PIC 9(5)V99.
000060 05 LS-FNL-TOTCOST PIC 9(7)V99.
000061
000120 PROCEDURE DIVISION USING LS-NUMBCONTR, LS-COMM, LS-CONTRTOT, LS-TOTCOST,
000121 LS-FNL-NUMBCONTR, LS-FNL-CONTRTOT, LS-FNL-COMM, LS-FNL-TOTCOST.
000122 CALC-TOTALS.
000130 ADD LS-NUMBCONTR TO LS-FNLNUMCONT
000140 ADD LS-CONTRTOT TO LS-FNL-CONTRTOT
000141 ADD LS-COMM TO LS-FNL-COMM
000142 ADD LS-TOTCOST TO LS-FNL-TOTCOST
000150
000160 EXIT PROGRAM.
I know this is long but I wanted to make sure that you understood what I was looking at. Again, the program links and executes just fine. HELP.
PS Here is the first 2 lines of the input file just in case someone feels like going beyond just looking. Thanks in advance.
072786100103ALLENSON, SHEILA M. CONTEMPORARY DESK 202386800873403
072786100105ANDERSON, ARLENE T. EXECUTIVE DESK CHAIR301259301005005
David
Here is the main program call
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. PROGRAM3.
000030 AUTHOR. DAVID RIVERA.
000040
000050 ENVIRONMENT DIVISION.
000060 INPUT-OUTPUT SECTION.
000070 FILE-CONTROL.
000080 SELECT COMMREPINPUT-FILE ASSIGN TO SYSIN
000090 ORGANIZATION IS LINE SEQUENTIAL.
000100 SELECT COMMREPOUTPUT-FILE ASSIGN TO SYSOUT
000110 ORGANIZATION IS LINE SEQUENTIAL.
000120
000130 DATA DIVISION.
000140 FILE SECTION.
000150 FD COMMREPINPUT-FILE
000160 RECORD CONTAINS 67 CHARACTERS
000170 DATA RECORD IS COMMREPINPUT-RECORD.
000171
000180 01 COMMREPINPUT-RECORD.
000190 05 FILLER PIC X(6).
000200 05 CRI-CONTNUMB PIC 9(6).
000210 05 CRI-CONTOWNER PIC X(20).
000220 05 FILLER PIC X(25).
000230 05 CRI-NUMBCONTR PIC 9(2).
000240 05 FILLER PIC X(2).
000250 05 CRI-CONTCOST PIC 99V99.
000260 05 FILLER PIC X(2).
000270
000280 FD COMMREPOUTPUT-FILE
000290 RECORD CONTAINS 132 CHARACTERS
000300 DATA RECORD IS COMMREPOUTPUT-RECORD.
000310 01 COMMREPOUTPUT-RECORD.
000320 05 FILLER PIC X(1).
000330 05 CRO-CONTNUMB PIC ZZZZZ9.
000340 05 FILLER PIC X(2).
000350 05 CRO-CONTOWNER PIC X(20).
000360 05 FILLER PIC X(5).
000370 05 CRO-NUMBCONTR PIC Z9.
000380 05 FILLER PIC X(6).
000390 05 CRO-CONTCOST PIC $$$.99.
000400 05 FILLER PIC X(4).
000410 05 CRO-CONTRTOT PIC $$,$$$.99.
000420 05 FILLER PIC X(5).
000430 05 CRO-COMMISS PIC $$$$.99.
000440 05 FILLER PIC X(5).
000450 05 CRO-TOTCOST PIC $$$,$$$.99.
000460
000470 WORKING-STORAGE SECTION.
000480 01 WS-EOF-FLAG PIC X.
000490 01 WS-ARGUMENTS.
000500 05 WS-COMM PIC 999V99.
000510 05 WS-CONTRTOT PIC 9999V99.
000520 05 WS-TOTCOST PIC 99999V99.
000530 01 WS-ACCUMULATORS.
000540 05 WS-FNL-NUMBCONTR PIC 9999.
000550 05 WS-FNL-CONTRTOT PIC 9(6)V99.
000560 05 WS-FNL-COMM PIC 9(5)V99.
000570 05 WS-FNL-TOTCOST PIC 9(7)V99.
000580 01 HEADING-LINE1.
000590 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000600 05 FILLER PIC X(7).
000610 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000620 05 FILLER PIC X(7).
000630 05 FILLER PIC X(9) VALUE 'NUMBER OF'.
000640 05 FILLER PIC X(2).
000650 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000660 05 FILLER PIC X(4).
000670 05 FILLER PIC X(8) VALUE 'CONTRACT'.
000680 05 FILLER PIC X(20).
000690 05 FILLER PIC X(5) VALUE 'TOTAL'.
000700
000710 01 HEADING-LINE2.
000720 05 FILLER PIC X(1).
000730 05 FILLER PIC X(6) VALUE 'NUMBER'.
000740 05 FILLER PIC X(10).
000750 05 FILLER PIC X(5) VALUE 'OWNER'.
000760 05 FILLER PIC X(8).
000770 05 FILLER PIC X(9) VALUE 'CONTRACTS'.
000780 05 FILLER PIC X(4).
000790 05 FILLER PIC X(4) VALUE 'COST'.
000800 05 FILLER PIC X(8).
000810 05 FILLER PIC X(5) VALUE 'TOTAL'.
000820 05 FILLER PIC X(5).
000830 05 FILLER PIC X(10) VALUE 'COMMISSION'.
000840 05 FILLER PIC X(7).
000850 05 FILLER PIC X(4) VALUE 'COST'.
000851
000870 01 TOTAL-LINE.
000880 05 FILLER PIC X(15) VALUE 'TOTAL CONTRACTS'.
000890 05 FILLER PIC X(1) VALUE SPACES.
000900 05 TL-FNL-NUMBCONTR PIC ZZZ9.
000910 05 FILLER PIC X(16) VALUE SPACES.
000920 05 FILLER PIC X(12) VALUE 'FINAL TOTALS'.
000930 05 FILLER PIC X(2) VALUE SPACES.
000940 05 TL-FNL-CONTRTOT PIC $$$$,$$$.99.
000950 05 FILLER PIC X(2) VALUE SPACES.
000960 05 TL-FNL-COMM PIC $$$,$$$.99.
000970 05 FILLER PIC X(2) VALUE SPACES.
000980 05 TL-FNL-TOTCOST PIC $$,$$$,$$$.99.
000990
001000 PROCEDURE DIVISION.
001010 PREPARE-COMMODREP-REPORT.
001020 OPEN INPUT COMMREPINPUT-FILE
001030 OUTPUT COMMREPOUTPUT-FILE
001040 MOVE "N" TO WS-EOF-FLAG
001050 READ COMMREPINPUT-FILE
001060 AT END MOVE "Y" TO WS-EOF-FLAG
001070 END-READ.
001080
001090 PERFORM WRITE-HEADING-LINE1.
001100 PERFORM WRITE-HEADING-LINE2.
001110 PERFORM UNTIL WS-EOF-FLAG IS EQUAL TO "Y"
001130 MOVE SPACES TO COMMREPOUTPUT-RECORD
001140 MOVE CRI-CONTNUMB TO CRO-CONTNUMB
001150 MOVE CRI-CONTOWNER TO CRO-CONTOWNER
001160 MOVE CRI-NUMBCONTR TO CRO-NUMBCONTR
001170 MOVE CRI-CONTCOST TO CRO-CONTCOST
001171 CALL 'CALCCOMMSUB'
001172 USING CRI-NUMBCONTR, CRI-CONTCOST, WS-ARGUMENTS
001173 END-CALL
001174
001175 MOVE WS-CONTRTOT TO CRO-CONTRTOT
001176 MOVE WS-COMM TO CRO-COMMISS
001177 MOVE WS-TOTCOST TO CRO-TOTCOST
001178 MOVE WS-TOTCOST TO CRO-TOTCOST
001179 CALL 'ACCTOTLSUB'
001180 USING CRI-NUMBCONTR, WS-COMM, WS-CONTRTOT, WS-TOTCOST, WS-FNL-NUMBCONTR, WS-FNL-CONTRTOT, WS-FNL-COMM, WS-FNL-TOTCOST
001181 END-CALL
001182 MOVE WS-FNL-NUMBCONTR TO TL-FNL-NUMBCONTR
001183 MOVE WS-FNL-CONTRTOT TO TL-FNL-CONTRTOT
001184 MOVE WS-FNL-COMM TO TL-FNL-COMM
001185 MOVE WS-FNL-TOTCOST TO TL-FNL-TOTCOST
001189 WRITE COMMREPOUTPUT-RECORD
001320 READ COMMREPINPUT-FILE
001330 AT END MOVE "Y" TO WS-EOF-FLAG
001340 END-READ
001350 END-PERFORM.
001361
001384 PERFORM WRITE-TOTAL-LINE.
001430 CLOSE COMMREPINPUT-FILE.
001450 CLOSE COMMREPOUTPUT-FILE.
001460 STOP RUN.
001470 WRITE-HEADING-LINE1.
001490 MOVE SPACES TO COMMREPOUTPUT-RECORD.
001500 WRITE COMMREPOUTPUT-RECORD.
001510 MOVE HEADING-LINE1 TO COMMREPOUTPUT-RECORD.
001520 WRITE COMMREPOUTPUT-RECORD.
001530
001540 WRITE-HEADING-LINE2.
001550 MOVE HEADING-LINE2 TO COMMREPOUTPUT-RECORD.
001560 WRITE COMMREPOUTPUT-RECORD.
001570 MOVE SPACES TO COMMREPOUTPUT-RECORD.
001580 WRITE COMMREPOUTPUT-RECORD.
001590
001600 WRITE-TOTAL-LINE.
001610 MOVE SPACES TO COMMREPOUTPUT-RECORD.
001620 WRITE COMMREPOUTPUT-RECORD.
001630 MOVE TOTAL-LINE TO COMMREPOUTPUT-RECORD.
001640 WRITE COMMREPOUTPUT-RECORD.
001650
Here is the first sub-routine
000010 IDENTIFICATION DIVISION.
000011 PROGRAM-ID. CALCCOMMSUB.
000012 AUTHOR. DAVID RIVERA
000013
000016 LINKAGE SECTION.
000018 01 LS-NUMBCONTR PIC 9(2).
000019 01 LS-CONTCOST PIC 99V99.
000021 01 LS-ARGUMENTS.
000022 05 LS-COMM PIC 999V99.
000023 05 LS-CONTRTOT PIC 9999V99.
000024 05 LS-TOTCOST PIC 99999V99.
000025
000026 PROCEDURE DIVISION USING LS-NUMBCONTR, LS-CONTCOST, LS-ARGUMENTS.
000028 COMPUTE LS-CONTRTOT = LS-NUMBCONTR * LS-CONTCOST
000030 IF LS-CONTRTOT <= 1000.00
000031 COMPUTE LS-COMM = LS-CONTRTOT * 0.7
000032 ELSE
000033 COMPUTE LS-COMM = (LS-CONTRTOT - 1000.00) * 0.5 + 70.00
000034 END-IF
000035 COMPUTE LS-TOTCOST = LS-CONTRTOT + LS-COMM
000036 END-COMPUTE.
000037 EXIT PROGRAM.
Here is the last sub-routine
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. ACCTOTLSUB
000030 AUTHOR. DAVID RIVERA
000040
000050 LINKAGE SECTION.
000051 01 LS-NUMBCONTR PIC 9(2).
000053 01 LS-COMM PIC 99V99.
000054 01 LS-CONTRTOT PIC 9999V99.
000055 01 LS-TOTCOST PIC 99999V99.
000056 01 WS-ACCUMULATORS.
000057 05 LS-FNL-NUMBCONTR PIC 9999.
000058 05 LS-FNL-CONTRTOT PIC 9(6)V99.
000059 05 LS-FNL-COMM PIC 9(5)V99.
000060 05 LS-FNL-TOTCOST PIC 9(7)V99.
000061
000120 PROCEDURE DIVISION USING LS-NUMBCONTR, LS-COMM, LS-CONTRTOT, LS-TOTCOST,
000121 LS-FNL-NUMBCONTR, LS-FNL-CONTRTOT, LS-FNL-COMM, LS-FNL-TOTCOST.
000122 CALC-TOTALS.
000130 ADD LS-NUMBCONTR TO LS-FNLNUMCONT
000140 ADD LS-CONTRTOT TO LS-FNL-CONTRTOT
000141 ADD LS-COMM TO LS-FNL-COMM
000142 ADD LS-TOTCOST TO LS-FNL-TOTCOST
000150
000160 EXIT PROGRAM.
I know this is long but I wanted to make sure that you understood what I was looking at. Again, the program links and executes just fine. HELP.
PS Here is the first 2 lines of the input file just in case someone feels like going beyond just looking. Thanks in advance.
072786100103ALLENSON, SHEILA M. CONTEMPORARY DESK 202386800873403
072786100105ANDERSON, ARLENE T. EXECUTIVE DESK CHAIR301259301005005
David