Writing an exit program

The tablesONLINE distribution tape includes a copybook called EXITISPF and three example user exit programs—EXAMTBLS, EXAMITMS, and EXAMFLDS. Follow the structure of the examples to assist in writing your own user exit programs.

In many applications, particularly for validations which are used often, it is worthwhile to make the exit programs themselves table-driven for ease of maintenance. For example, a table-driven exit program could validate product numbers by applying the SK (Search by Key) command against a table of products using the product number as key. If the product does not exist, then the company does not carry the product.

One advantage of a table-driven exit program is achieved by replacing SK with FK (Fetch by Key). This setup not only validates the field but also retrieves a table item. For example, if the product number is valid, you would get the item describing it. Consequently, if another part of your application needs to know the product’s price or which division makes it, that information is immediately available.