Information Technology Reference
In-Depth Information
indicator = space
write numbfile
if numb-status > 0
process-sw = 9
end-if
end-if
end-if
end-program: end
Notice that the program name is
nextnumb ,
which appears to be a relatively simple program - for a change. The line
program-name : nextnumb link data-fields
has a new keyword,
link ,
which enables the passing of data from the calling to the called program. We used the
same data name, but they could be different variables as long as the size and
characteristics are the same. When the calling program transferred control here, the field
data-fields
had a value of 0 for each field.
data-fields
will be used to pass new values for those fields back to whatever program calls it. Next
we define the records on the next number file. It has only two fields, the account number
and the indicator. Just as the calling program transferred data, as trivial as it was, we need
to pass back data to that program, namely the new account number and a record status.
We use
define data-fields structure
new-account-number integer( 9) value 0
process-sw integer value 0 .
The field
process-sw
will be 0 for a successful process of the next number file. This entire process involves
reading the first record there, moving the new account number to the field
new-account-number,
deleting the record just read and adding a new one, unless the account number moved had
been used before. If the next number file is busy, 3 will be returned in
process-sw
and if there's a problem with the read, write or delete, a 9 will be passed back. In this case
the new account number returned to the calling program will not be used. The new
keyword
delete
Search WWH ::




Custom Search