Identification Division.
Program-Id. JEE-Exam.
Environment Division.
Input-Output Section.
File-Control.
Select Bio-File Assign To Disk
Organization Is Line Sequential.
Select Marks-File Assign To Disk
Organization Is Line Sequential.
Select Out-File Assign To Disk
Organization Is Line Sequential.
Data Division.
File Section.
FD Bio-File
Label Records Are Standard
Value Of File-Id Is File-Bio.
01 Bio-Rec.
02 RegNo Pic 9(7).
02 State-C Pic 99.
02 Name Pic a(15).
02 Address Pic x(20).
FD Marks-File
Label Records Are Standard
Value Of File-Id Is File-Marks.
01 Marks-Rec.
02 RegNo Pic 9(7).
02 Maths Pic 999.
02 Phy Pic 999.
02 Chem Pic 999.
02 Eng Pic 999.
FD Out-File
Label Records Are Standard
Value Of File-Id Is File-Out.
01 Out-Rec.
02 RegNo Pic z(7).
02 Filler Pic xxx.
02 State-C Pic z9.
02 Filler Pic xxx.
02 Name Pic a(15).
02 Address Pic x(20).
02 Maths Pic zzz.
02 Filler Pic xxx.
02 Phy Pic zzz.
02 Filler Pic xxx.
02 Chem Pic zzz.
02 Filler Pic xxx.
02 Eng Pic zzz.
02 Filler Pic xxx.
02 Total Pic zzz.
02 Filler Pic xx.
Working-Storage Section.
01 H1 Pic x(80) Value " Reg. State Candidate Candidate
- " Marks Obtained Total".
01 H2 Pic x(80) Value " Number Code Name Address
- " Maths Phy. Chem. Eng. Marks".
01 Line-Rec Pic x(80) Value All "Ü".
01 Space-Rec Pic x(80) Value All Spaces.
77 File-Bio Pic x(12).
77 File-Marks Pic x(12).
77 File-Out Pic x(12).
77 EOF1 Pic x Value "N".
77 EOF2 Pic x Value "N".
Procedure Division.
Main-Para.
Perform Open-Para.
Perform Heading-Para.
Perform Read-Bio-Para.
Perform Read-Marks-Para.
Perform Process-Para Until EOF1 = "Y" Or EOF2 = "Y".
Perform End-Para.
Stop Run.
Open-Para.
Display(8, 15) "Enter the Bio-Data File Name :".
Accept(8, 50) File-Bio With Prompt.
Display(10, 15) "Enter the Marks File Name :".
Accept(10, 50) File-Marks With Prompt.
Display(12, 15) "Enter the Ouput File Name :".
Accept(12, 50) File-Out With Prompt.
Open Input Bio-File Marks-File
Output Out-File.
Heading-Para.
Write Out-Rec From Line-Rec.
Write Out-Rec From Space-Rec.
Write Out-Rec From H1.
Write Out-Rec From H2.
Write Out-Rec From Space-Rec.
Write Out-Rec From Line-Rec.
Write Out-Rec from Space-Rec.
Move Spaces To Out-Rec.
Read-Bio-Para.
Read Bio-File At End Move "Y" To EOF1.
Read-Marks-Para.
Read Marks-File At End Move "Y" To EOF2.
Process-Para.
If (RegNo Of Bio-Rec = RegNo Of Marks-Rec)
Perform Total-Para
Perform Move-Write-Para
Perform Read-Bio-Para
Perform Read-Marks-Para.
Total-Para.
Compute Total = Maths Of Marks-Rec + Phy Of Marks-Rec
+ Chem Of Marks-Rec + Eng Of Marks-Rec.
Move-Write-Para.
Move Corr Bio-Rec To Out-Rec.
Move Corr Marks-Rec To Out-Rec.
Write Out-Rec.
End-Para.
Write Out-Rec From Space-Rec.
Write Out-Rec From Line-Rec.
Close Bio-File Marks-File Out-File.