identification division
program-id test.
data division.
working-storage section.
01 inrec.
02 empcode pic x(4).
02 f pic x.
02 dayspresent pic x(2).
02 f pic x.
02 daysabsent pic x(2).
02 f pic x.
02 overtimehrs pic x(2).
02 f pic x.
77 ke pic x(4).
77 ov pic x(2).
procedure division.
accept inrec.
move empcode of inrec to ke.
move overtimehrs of inrec to ov.
call 'checkgrade' using ke ov.
stop run.
identification division.
program-id checkgrade.
................................
................................
...............................
................................
if (a condition was checked)
call 'ins'.
end-if.
program-id test.
data division.
working-storage section.
01 inrec.
02 empcode pic x(4).
02 f pic x.
02 dayspresent pic x(2).
02 f pic x.
02 daysabsent pic x(2).
02 f pic x.
02 overtimehrs pic x(2).
02 f pic x.
77 ke pic x(4).
77 ov pic x(2).
procedure division.
accept inrec.
move empcode of inrec to ke.
move overtimehrs of inrec to ov.
call 'checkgrade' using ke ov.
stop run.
identification division.
program-id checkgrade.
................................
................................
...............................
................................
if (a condition was checked)
call 'ins'.
end-if.
identification division
program-id ins.
environment division.
input-output section.
file-control.
select infile assign to dd1
organization indexed
access is empcode
record key is empcode
file status is fs1.
data division.
file section.
fd infile.
01 inrec.
02 empcode pic x(4).
02 f pic x.
02 dayspresent pic x(2).
02 f pic x.
02 daysabsent pic x(2).
02 f pic x.
02 overtimehrs pic x(2).
02 f pic x.
working-storage sectio.
77 fs1 pic x(2).
procedure division.
open extend infile.
if fs1 not = '00'
display fs1.
close infile.
enf-if.
perform wr-pa.
perform cp-pa.
wr-pa. //this is the problamatic para
accept inrec.
write inrec.
cp-pa.
close infile.
exit program.
program-id ins.
environment division.
input-output section.
file-control.
select infile assign to dd1
organization indexed
access is empcode
record key is empcode
file status is fs1.
data division.
file section.
fd infile.
01 inrec.
02 empcode pic x(4).
02 f pic x.
02 dayspresent pic x(2).
02 f pic x.
02 daysabsent pic x(2).
02 f pic x.
02 overtimehrs pic x(2).
02 f pic x.
working-storage sectio.
77 fs1 pic x(2).
procedure division.
open extend infile.
if fs1 not = '00'
display fs1.
close infile.
enf-if.
perform wr-pa.
perform cp-pa.
wr-pa. //this is the problamatic para
accept inrec.
write inrec.
cp-pa.
close infile.
exit program.