Displaying Source Code(s)
|
|
Program to compute gross dividend.
--------------------------------------------------------------------------------
IDENTIFICATION DIVISION.
PROGRAM-ID. Q3.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM PC.
OBJECT-COMPUTER. IBM PC.
INPUT-OUTPUT SECTION.
SELECT IN-FILE ASSIGN TO "Q3IN.DAT" ORGANIZATION IS
LINE SEQUENTIAL.
SELECT OUT-FILE ASSIGN TO "Q3OUT.TXT".
DATA DIVISION.
FILE SECTION.
FD IN-FILE.
01 IN-REC.
02 IN-FACEVAL PIC 999.
02 IN-RATE PIC V99.
FD OUT-FILE.
01 OUT-REC PIC X(80).
WORKING-STORAGE SECTION.
77 GROSS-DIVIDEND PIC 9(3).9(2).
77 EOF pic X value "N".
77 HEADING1 PIC X(80) VALUE ALL "-".
77 SNO PIC 99 VALUE 0.
01 OUT-FORMAT.
02 OUT-SNO PIC X(5).
02 F PIC X(15) VALUE SPACES.
02 OUT-GROSS-DIVIDEND PIC 99.99.
PROCEDURE DIVISION.
MAIN-PARA.
OPEN INPUT IN-FILE OUTPUT OUT-FILE.
MOVE HEADING1 TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.
MOVE " GROSS DIVIDEND REPORT"
TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE .
MOVE HEADING1 TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.
MOVE "SNO GROSS VALUE" to OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.
READ IN-FILE AT END MOVE "Y" TO EOF.
PERFORM CALC-PARA UNTIL EOF = "Y".
DISPLAY "THE DETAILS HAVE BEEN WRITTEN TO FILE Q3OUT.DAT".
CLOSE IN-FILE , OUT-FILE.
STOP RUN.
CALC-PARA.
ADD 1 TO SNO.
COMPUTE GROSS-DIVIDEND = ( IN-FACEVAL * IN-RATE )/ 100.
MOVE SNO TO OUT-SNO.
MOVE GROSS-DIVIDEND TO OUT-GROSS-DIVIDEND.
MOVE OUT-FORMAT TO OUT-REC.
WRITE OUT-REC BEFORE ADVANCING 1 LINE.
READ IN-FILE AT END MOVE "Y" TO EOF.
--------------------------------------------------------------------------------
|
|
|