Identification Division. Program-id. Q1. Environment Division. Configuration Section. ...
Program-id. Q1.
Environment Division.
Configuration Section.
Source-Computer. IBM PC.
Object-Computer. IBM PC.
Input-Output Section.
SELECT in-file assign to "IN.DAT" organization is
line sequential.
SELECT out-file assign to "Out.txt".
Data Division.
File Section.
FD in-file.
01 in-rec.
02 in-itemno pic X(5).
02 in-cost pic 9(3)V9(2).
02 in-scrapvalue pic 9(3)v9(2).
02 in-y-o-l pic 99.
FD out-file.
01 out-rec pic X(80).
Working-Storage Section.
77 depreciation pic 9(3).9(2).
77 EOF pic X value "N".
77 Heading1 pic X(80) value all "-".
01 out-format.
02 out-itemno pic X(5).
02 F pic X(15) value spaces.
02 out-depreciation pic 999.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 " YEARLY DEPRECIATION REPORT"
to out-rec.
Write out-rec before advancing 1 line.
Move Heading1 to out-rec.
Write out-rec before advancing 1 line.
Move "ITEM CODE DEPRECIATION" 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 OUT.DAT".
Close in-file , out-file.
Stop Run.
calc-para .
Compute depreciation = ( in-cost - in-scrapvalue ) / in-y-o-l.
Move in-itemno to out-itemno.
Move depreciation to out-depreciation.
Move out-format to out-rec.
Write out-rec before advancing 1 line.
Read in-file at end move "Y" to EOF.
No comments
Post a Comment