Procedures, functions etc.

You must include a procedure and a function in this set of programs.  You should also pass data to the procedure and function.  You can decide what code to put in the procedure and what code to put in the function after analyzing the criteria for the program.

First program:

You must write a program that creates a sequential file that you will use in the second program. Your form should allow the user to input the information that will be written to the file to create a record on the file. You should create about a dozen different records. Analyze the specifications for the second program and create the data so that at least one record will meet the different criteria. For example, some records should have the on hand + on order less than the reorder point and some should have on hand + on order greater than the reorder point etc.

The data should be edited for accuracy when it is entered.  For example you should edit to make sure that the Category is A, B or C and that the on hand, on order and reorder point are numeric.

This is not terribly realistic (assigning an item number and including an item name, a selected vendor and a state of the vendor) but…

The user will enter the data except the id number. The id number should be created in the following way:  I want the third, fourth and fifth characters of the item name followed by the state field followed by the first and last character of the selected vendor, followed by the category letter.

The file should have the following layout:

Second program:

This program should read a record and display the information from the record on the form. There should be an additional field that will show the number to be ordered as a result of the calculation.

When the calculate button is pressed, the calculation should be done according to the criteria below. If there are items to be ordered, the number should show in the additional field on the form.

Processing specifications based on a calculate button: Note the questions about category B should be handled together in the sense that there should be only one IF that asks if category is B.

Write a new output file that contains all records. If it has been determined that an order should be placed then the on order field on the new file should be the sum of the on order field on the old file plus the amount that was ordered.