Information Technology Reference
In-Depth Information
work-array
=
spaces
account-number
= 9
perform
load-array
until
process-sw
> 0
perform
sort-array
varying
i-sub
from
1
by
1
until
i-sub
=
record-count
- 1
perform
write-file
varying
i-sub
from
1
by
1
until
i-sub
=
record-count
go to
end-program
load-array:
i-sub
=
i-sub
+ 1
readnext
acctfile
if
acct-status
= 0
then
c-element
(
i-sub
) =
account-record
else
if
acct-status
= 9
process-sw
= 1
record-count
=
i-sub
- 1
else
error-msg
= “problem reading the file; program aborting - press enter”
go to
end-program
end-if
end-if
sort-array:
process-sw
= 0
t-sub
=
i-sub
perform
match-ssn
until
process-sw
= 1
match-ssn:
t-sub
=
t-sub
+ 1
if
c-element
(
i-sub
)(86:5) >
c-element
(
t-sub
)(86:5)
hold-line
=
c-element
(
i-sub
)
c-element
(
i-sub
) =
c-element
(
t-sub
)
c-element
(
t-sub
) =
hold-line
end-if
if
t-sub
=
record-count
process-sw
= 1
end-if
write-file:
new-record
=
c-element
(
i-sub
)
write
newfile
if
new-status
> 0
error-msg
=
“problem writing the file; program aborting - press enter”
go to
end-program
end-if
end-program:
screen
(24,20)
error-msg
input
end
The paragraph
load-array
should be recognizable as logic we've done before, just reading in a file of data and
loading it to an array. We accomplish the read of the first record because