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 theMAIN
block, and theMENU
statement to let the user choose an action to perform: query, append, update, delete rows. This module imports thecustquery
andcustdata
modules. - The
custquery
module implements database query function with theCONSTRUCT
instruction, and uses an SQL cursor to handle the result set of theSELECT
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 ast_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.