You are here: Development Standards > OSAS Standards > Program Structure > General Routine Structure

# General Routine Structure

General routines are sections of code that are merged into each program when needed. They provide a consistent method of performing particular tasks so that the user can expect a consistent response to a similar condition regardless of the application. They also eliminate the need to enter the same section of code several times.

You must maintain compatibility with the OSAS standards. Future standards will try to retain as much of the current functionality and entry points as possible so that a great deal of code does not have to be changed when a module is improved.

You can treat these code modules as black boxes. A set of input and output data is defined for each OSAS system routine. The functionality of each routine is fixed to perform only particular tasks. These routines must never be changed except by OSAS development for new software versions.

General routines are internal to each program. These subroutines are accessed with the GOSUB statement.

General routines have well-defined entry points.

The general routines most often exit with a RETURN statement, transferring control to the statement following the GOSUB statement. The general routine may allow execution to exit in different ways. A routine may allow the user to enter a command during an error message and force a restart instead of returning to the place where the routine was executed.

General routines have the following advantages:

- Code consistency. One set of code is merged into all programs that need the task performed.
- User consistency. The user sees the same routine executed so that the functionality remains identical between tasks.

For a routine to qualify as a general routine, it must be used extensively in most or all of the programs in all the applications. The routine must not have any code specific to any application. For example, the INUPD routine is not considered a general routine because it contains code specific to the Inventory application. The routine does allow for a consistent interface with the Inventory application, however, so it is defined as part of the Inventory application standards. By contrast, GENERROR is used in all applications in the same manner to trap particular error conditions for consistent handling and user notification.

All general and local routines can be merged directly into programs, using the PRO/5 _update function and the library files.

General routines sometimes have auxiliary code sections that work with them. You must define these sections for the particular task programs. These sections include 9200 delete record, 8470 abandon (X) and start-over (S) logic processing, and 9990 exit from program, among others.

WARNING: You must use the general routines as they are supplied; do not change them.

EXCEPTION: Some routines are absolute. The INFO routine at 6200 is an example. GENLIB contains a common do-nothing GENINFO section that allows GENINPUT to pass control when the INFO key is pressed for all programs. Only programs that contain an activated xxINFO section should perform a task. This routine is not necessarily fixed even within a single application. It may be desirable in some programs to present a single task in lieu of the full INFO menu. It is permissible to modify this section in each program to customize the functionality.