identification division.
program-id last.
data division.
working-storage section.
exec sql
include sqlca
end-exec.
exec sql
include empta
end-exec.
exec sql
declare c1 cursor for select empno,empname,activity from empta for fetch only
end-exec.
procedure division.
exec sql
open c1
end-exec.
perform fp-pa until sqlcode=100.
perform rd-pa.
exec sql
close c1
end-exec.
stop run.
fp-pa.
fetch c1 into:empno,empname,activity.
rd-pa.
fetch last c1 into:empno,empname,activity.
display empno.
display empname.
display activity.
program-id last.
data division.
working-storage section.
exec sql
include sqlca
end-exec.
exec sql
include empta
end-exec.
exec sql
declare c1 cursor for select empno,empname,activity from empta for fetch only
end-exec.
procedure division.
exec sql
open c1
end-exec.
perform fp-pa until sqlcode=100.
perform rd-pa.
exec sql
close c1
end-exec.
stop run.
fp-pa.
fetch c1 into:empno,empname,activity.
rd-pa.
fetch last c1 into:empno,empname,activity.
display empno.
display empname.
display activity.
hello freinds i am just a beginner in mf
i want to fetch the last record from the cursor memory,but i am getting abend s322 executing this piece of code.can any one help me to resolve my problem.