Information Technology Reference
In-Depth Information
(>= “A” and <= “Z”)
will be satisfied if any of the letters from A to Z are entered and the second part of that
check
(>= “a” and <= “z”) ,
you should be able to figure out. Both sets of parentheses are needed here because we
want the input to be between A and Z , inclusive, without which special characters could
sneak in. If you're wondering why we allow lower case letters of the alphabet for the
middle initial, we have to consider people like e. e. cummings. Note that we won't accept
the dollar sign for the middle initial - that's probably a good thing. The operator can exit
the program by entering xx for the last name - the only way out. The fields
data-fields
are used to obtain data from the called program, specifically the new account number and
process-sw ,
which indicates whether or not the call was a success. The two fields are passed to
nextnumb
with each being 0, since all the information will be obtained from the called program.
New keywords are
call
and
using,
both used in the statement to get the data we need. The
call
keyword transfers control from the calling program (the program we're in) to
nextnumb
and it will use the field
data-fields
to accomplish that. Once the called program gets the next account number, it passes it
back to the calling program and the next statement after the call statement is executed.
Now we have to make sure the call worked, which it should. The next number file could
be busy, indicated by the number 3 in
process-sw .
If that happens, we can still proceed and try again, hoping the file will soon be freed up
soon for our use. If the value returned is 0, the call was a success and we have a new
account number, so we display it on the screen, write out a new account number file
record, produce a line of our report and now another last name can be entered. The update
shouldn't have a problem since the system is generating the account number and the
status should be 0.
There shouldn't be a problem with the call statement, but if there are problems
with either the call or the write of the account number file, an error message will be
displayed on the screen and printed on the report, with the program terminating. A line
will also be printing indicating how many records were written. Those will be for records
added to the file even if there are serious problems.
Search WWH ::




Custom Search