4.2.3 What is a Function?
In LANSA, a function is a group of RDML commands. It is a set of RDML commands which are compiled into an executable program. For example, an interactive or online function might add or change data in the Employee file. The function uses a character-based presentation. A batch function might produce an employee report or update available employee records. Functions are procedural in nature.
Following are some important characteristics of functions:
- A function cannot be created without a process.
- Functions must have a name and description. Function names must be unique within processes and must be unique in a partition. Function names may be up to 7 characters.
- Functions can be created automatically using templates, or can be created manually, or can be copied from an existing function. (Copied functions must be in the same partition.)
- A function must be compiled before it can be used.
- Functions compiled using Visual LANSA must use the FUNCTION OPTION(*DIRECT) command. Consequently, Visual LANSA function names must be unique in the partition.
- Functions support character-based presentation formats using RDML commands.
Just as in any computer program, modular or well structured code is important for maintenance. The developer is responsible for how functions are constructed. (Refer to 4.1.3 RDML Practices.)
Platform Considerations
- IBM i: A process name must be unique within the entire LANSA partition. A function name must be unique within the process it is created. It is possible to have two functions with the same name in a single partition if they are located in different processes.
- Windows: A process name must be unique within the entire LANSA system. All functions must be defined as type *DIRECT. Functions names must be unique in the partition.
Also See
4.2.5 How to Create Functions