Modules organization

The customer management program is build from different modules with specific roles.

For best practice, you should organize your code in different modules by tasks, and publish only the functions, types, constants or module variables that are needed by other modules.

In the sample code of this chapter, the following modules are used to organize the source code by tasks:
  • The custmain module implements the MAIN block, and the MENU statement to let the user choose an action to perform: query, append, update, delete rows. This module imports the custquery and custdata modules.
  • The custquery module implements database query function with the CONSTRUCT instruction, and uses an SQL cursor to handle the result set of the SELECT statement. This module imports public symbosl
  • The custdata module implements functions to append, update, delete customer rows. The module provides also user defined types such as t_cust_num, that can be reused by other modules to define their variables.
  • The comutils module implements utility functions, such as mbox_yn which shows a popup box to the user, and asks for a Yes/No answer.