identification
division. test-sign-in3 019-001 -001 035 032-005 001 019 -005-004 test-sign-in2 -019-001 -001 035 032 045 001 019 -005-004
program-id.
sign-testing.
environment
division.
input-output
section.
file-control.
select
test-sign-in2 assign to"testsignin2.dat"
organization
is line sequential.
select test-sign-in3 assign to
"testsignin3.dat"
organization
is line sequential.
select
test-sign-out assign to "testsignout.dat"
organization
is line sequential.
data
division.
file
section.
fd test-sign-in2.
01
test-sign-in-rec2.
05 temp-low pic -999.
05 temp-high pic -999.
fd test-sign-in3.
01
test-sign-in-rec3.
05 temp-noon pic -999.
05 temp-eve
pic -999.
fd test-sign-out.
01
test-sign-out-rec pic
+zz9.
working-storage
section.
01 eof pic xxx value
"no".
01
temp-diff pic
S999.
01 ws-temp-high
pic
S999.
01 ws-temp-low
pic S999.
01 ws-temp-noon
pic
S999.
01 ws-temp-eve
pic S999.
procedure division.
100-main-paragraph.
open
input test-sign-in2 test-sign-in3.
open
output test-sign-out.
***input file is
ordered low value
first then higher value
***
read
test-sign-in2
at
end move "yes" to eof.
perform
200-file-ordered until eof = "yes".
***
***answers: 18, 36, 13, 18, 1
******************************************************
move
spaces to test-sign-out-rec.
write
test-sign-out-rec.
******************************************************
***input file is
NOT ordered low
then high
***
***
move
"no" to eof.
read
test-sign-in3
at
end move "yes" to eof.
perform
300-noon-eve-order until eof = "yes".
***
***answers: 20,
36, 37, 18, 1
***what does
output file look like
exactly?!
close
test-sign-in2 test-sign-in3 test-sign-out.
stop
run.
200-file-ordered.
move
temp-low to ws-temp-low
move
temp-high to ws-temp-high
compute
temp-diff = ws-temp-high - ws-temp-low
write
test-sign-out-rec from temp-diff
read
test-sign-in2
at
end move "yes" to eof.
300-noon-eve-order.
move
temp-noon to ws-temp-noon
move
temp-eve to ws-temp-eve
if ws-temp-eve
> ws-temp-noon
compute
temp-diff = ws-temp-eve - ws-temp-noon
else
compute
temp-diff = ws-temp-noon - ws-temp-eve
end-if
write
test-sign-out-rec from temp-diff
read
test-sign-in3
at end move
"yes" to eof.