Sunteți pe pagina 1din 2

identification division.

program-id. sortprac.
environment division.
input-output section.
file-control.
select studp assign to disk.
select wfile1 assign to disk.
select sortfile assign to disk.
data division.
file section.
fd studp
label records are standard
value of file-id is "studp.doc".
01 rec1.
02 roll-no pic 9(3).
02 filler pic x(5).
02 name pic a(10).
02 marks pic 999.
sd wfile1.
01 wrec1.
02 wroll-no pic 9(3).
02 filler pic 9(5).
02 wname pic a(10).
02 wmarks pic 999.
fd sortfile
label records are standard
value of file-id is "sort.dat".
01 sortrec pic x(34).
working-storage section.
77 more pic a value 'y'.
procedure division.
main.
display "Sorting of sequential files".
open output studp.
perform accept-1 until more = 'n'.
close studp.
sort wfile1 on ascending key wname
descending key wmarks
using studp giving sortfile.
move 'y' to more.
open input sortfile.
perform disp-1 until more = 'n'
display " ".
close sortfile.
stop run.
disp.
read sortfile at end move 'n' to more.
if more = 'y'
display sortrec.
accept-1.
display "enter roll no".
accept roll-no.
display "enter name".
accept name.
display "enter marks".
accept marks.
write rec1.
display "want to enter more".
accept more.
disp-1.
read sortfile at end move 'n' to more.
if more = 'y'
display sortrec.

S-ar putea să vă placă și