Information Technology Reference
In-Depth Information
When we write another program we will have some other name and this is needed to keep
the programs separate. Note that we choose this name because we are listing acco unt
information. It's a good idea to make your choice meaningful, as that will help you later
when you have so many different programs.
The next few lines should be familiar as they describe the account record and all
the fields that make it up. Through the
structure
keyword we can reference any of our nine fields in the record. We need to do this in order
to print them on a report. Note that the end of the structure will be determined by the
keyword
read .
We then have two more keywords,
read
and
into
in the line
read acctfile into account-record .
The variable following
read
is our account file which has the name
acctfile ,
another variable. This line actually does two things. It opens the file and then reads it into
the account record layout, making all the fields available to us so we can put them on a
report. Using just
read acctfile
would accomplish the same result because of the way the file is defined. The keyword
record
ties the field,
account-record
to the account number file so that any read of that file will result in the data being moved
to the field,
account-record .
In the world of computers, there are numerous ways of doing things, which can be good
and bad. This I pointed out in an earlier chapter when I talked about systems and rules.
The next nine statements are all print statements using the keyword
print .
Hence the first one will print out the account number, which happens to be
391023123
in this case. The remaining eight print lines will then list the remaining eight fields in the
record, as shown on the listing above. Note that the last field is the account balance and it
is
1620,
which indicates an amount of
$16.20.
Search WWH ::




Custom Search