11.7 The FUNCTION Command

The FUNCTION command is specifically designed to allow some aspects of a compiled RDML program's logic to be altered for optimal performance in specific environmental conditions.

The OPTIONS parameter of the FUNCTION command allows the following values to be specified:

*NOMESSAGES

Specifies that the program will not receive from its caller, or route back to its caller, any messages (except if it fails). Using this option can significantly improve the entrance and exit resource use of an RDML program.

Mainly used in heavily used online applications and any form of subroutine, especially those working in a batch environment.

*DEFERWRITE

Specifies that any IBM i display file created to service DISPLAY, REQUEST or POP_UP commands should use the DFRWRT(*YES) parameter.

This value can significantly improve screen handling, reduce screen flickering and produce a better response time (particularly in applications run from remote devices). Refer to Flickering Windows and Program Efficiency for Pop-Up Windows for more details on the significance of the DFRWRT(*YES) parameter on the IBM i display files.

A good choice for most online applications where an "overlapped" database open is not required. Essential in applications that use the POP_UP command.

*HEAVYUSAGE / *LIGHTUSAGE

When a process is defined, an option to specify usage HEAVY or LIGHT can be nominated. This governs whether all the functions associated with the process "shutdown" when they have completed execution (LIGHT usage), or stay "active" (HEAVY usage).

This option allows the HEAVY or LIGHT characteristics of a particular function to be individually specified, regardless of what option the associated process uses.

*HEAVYUSAGE is a good choice for heavily used subroutines, particularly those working in a batch environment. Refer to 11.8 Clean Up Considerations for Heavy Usage Functions.

*DBOPTIMIZE / *DBOPTIMISE

This option indicates that "database access optimization" should be used. It is discussed in detail in the Technical Reference.

*DIRECT

This option indicates that the function is eligible for potential direct calling.

A direct call is considerably faster than a call via a process controller. Refer to the CALL command in the LANSA Technical Reference for a more complete explanation of how direct calls are used to improve performance.