coboldummy
Programmer
slade and other members
This is the code I have produced so far for my problem with cobol tables.
FD Student-File.
01 Student-Rec.
03 SF-CandNo Pic 99.
03 SF-Paper1-Mark Pic 999.
03 SF-Paper2-Mark Pic 999.
03 SF-Paper3-Mark Pic 999.
Working-Storage Section.
01 W-Student-EOF Pic X Value "N".
88 End-Of-Student-File Value "Y".
01 W-ExamTable.
03 W-Paper Occurs 3.
05 W-Mark Pic 999 Occurs 4.
Procedure Division.
Open Input Student-File
Move Zeros to W-ExamTable
Read Student-File
At End Move "Y" to W-Student-EOF
Not At End
Perform Paper1
Perform Paper2
Perform Paper3
End-Read.
Paper1.
Evaluate SF-Paper1-Mark
When SF-Paper1-Mark < 40
Add 1 to W-ExamTable(1,1)
When SF-Paper1-Mark > 39 AND < 50
Add 1 to W-ExamTable(1,2)
When SF-Paper1-Mark > 49 AND < 70
Add 1 to W-Examtable(1,3)
When SF-Paper1-Mark > 69
Add 1 to W-ExamTable(1,4)
End-Evaluate.
Ive got this far but I am sure I am not tackling the problem the right way. I think the Perform Varying should prehaps be used but dont know how to go about it.
Any help would be gratefully appreciated.
This is the code I have produced so far for my problem with cobol tables.
FD Student-File.
01 Student-Rec.
03 SF-CandNo Pic 99.
03 SF-Paper1-Mark Pic 999.
03 SF-Paper2-Mark Pic 999.
03 SF-Paper3-Mark Pic 999.
Working-Storage Section.
01 W-Student-EOF Pic X Value "N".
88 End-Of-Student-File Value "Y".
01 W-ExamTable.
03 W-Paper Occurs 3.
05 W-Mark Pic 999 Occurs 4.
Procedure Division.
Open Input Student-File
Move Zeros to W-ExamTable
Read Student-File
At End Move "Y" to W-Student-EOF
Not At End
Perform Paper1
Perform Paper2
Perform Paper3
End-Read.
Paper1.
Evaluate SF-Paper1-Mark
When SF-Paper1-Mark < 40
Add 1 to W-ExamTable(1,1)
When SF-Paper1-Mark > 39 AND < 50
Add 1 to W-ExamTable(1,2)
When SF-Paper1-Mark > 49 AND < 70
Add 1 to W-Examtable(1,3)
When SF-Paper1-Mark > 69
Add 1 to W-ExamTable(1,4)
End-Evaluate.
Ive got this far but I am sure I am not tackling the problem the right way. I think the Perform Varying should prehaps be used but dont know how to go about it.
Any help would be gratefully appreciated.