Now we’re at the point where we want to make certain that duplicate product codes will not be entered into the product file (“prod”). You should be at “Input Processing” and ready to create the table as shown in figures 16-1a and 16-1b.
Figure 16-1a
Figure 16-1b
When done, save the processing table then exit to the main menu. Each element of the processing table is explained as follows:
Element 1 When the user presses <ESC>, to save the record, there is
no work to do so the processing simply ends.
@WLF1
Elements 2-6 This processing starts when the user leaves field 1.
Element 2 If field 1 (“product code”) is empty, the computer BEEPs once, and the cursor reappears in field 1. If there is some-thing in field 1, processing “falls through” to the next element.
Element 3 A lockup to the “prod” file is performed. The key field in the current record is field 1 (“product code”) (“k = 1”). The index in the lockup file to use is “A” (“i = a”). If the lockup fails, nothing is done (“-n”). The contents of the key fields should match exactly (“x”).
Element 4 If the lockup fails, that is, the key fields don’t match, then processing ends; because the product code entered by the user is not a duplicate of one already in the file.
Element 5 If a system—maintained field, “@rn” (record number) in the lockup file is the same as the one in the current record, then the processing ends; because the user is updating an existing record.
Element 6 If the lockup is successful, and a product code in the lookup file matches the product code entered by the user in the current record, then a message is shown. The “< 1<” in the message will actually be the contents of field 1 when the message is displayed on the screen.
The cursor reappears in field 1, so the user can try again.
@WLF3 I
Elements 7-8 This processing begins when the user is leaving field 3
(“price”).
Element 7 If field 3 is empty, then the computer BEEPs once, and the
cursor reappears in field 3. If field 3 contains some value,
then processing “falls through” to the next element.
Element 8 If we reach element 8, then the price has been filled in, and
the processing simply ends.