Information Technology Reference
In-Depth Information
To start with, we have the new variables,
field-no ,
new-last-name,
new-first-name ,
new-balance ,
update-switch,
valid-input ,
and the structure
name-string .
To indicate which of the three fields will be changed, we need
field-no ,
a one-byte integer. The three fields that are defined beginning with the characters new are
the fields that will be used for the changes we make. The variable
update-switch
is needed to decide if that is to happen. If the field
valid-input
has a value of 1, this indicates that the input is fine for last name or first name. The
structure
name-string
consists of all the characters that are acceptable for either name and we will see how it is
used in conjunction with the keyword
index .
The initial process is the same as we found in the inquiry program insofar as an
account number can be keyed or the number 0 can be input to exit. The resulting screen is
a bit different in order to allow for the updating of the three fields. At this point the user
can now get the information on another account by entering 0 or she can enter 1 to change
the last name, 2 to change the first name or 3 to change the balance.
Let us proceed to the assignment statements after the line
screen (19,36) balance, mask ($$$$,$$9.99-).
The first three have to do with the values for the changed fields and we will get back to
them later. The next line sets the variable
update-switch
to 0 because at this point no update will take place. When it should occur, we'll set it
field to 1, which happens whenever one of the three variables is correctly modified. The
next field
field-no
is set to 9 but we could have used any value greater than 3. Note that we can't use 0
because if we did, then the next statement, the perform, wouldn't be executed. This
would just be an inquiry program with a great deal of dead code. This statement
perform get-change until field-no = 0
will be done until the variable
field-no
Search WWH ::




Custom Search