Calling a CA 2E Function
- The called function has to be defined as an external function in CA 2E (formerly Synon/2)
- Best practice according to our experience is to define 2E functions within Plex in a separate "2E function model"
- Steps to call a 2E function
- If available inherit the function from you 2E base functions where you can handle special 2E behavior like parameter handling in one place. In one or our project those 2E base functions are for instance:
- =2e AS400 Base with return code only
- =2e AS400 Base with parameters
- =2e AS400 Base CheckedUpdate
- The implementation name within Plex has to be exactly the same as in 2E
- Define the same parameters in Plex as in 2E
- An entry in the EDIT FUNCTION PARAMETERS screen in 2E is equivalent to a variable in Plex
- An entry in the EDIT FUNCTION PARAMETER DETAILS screen in 2E is equivalent to a field within a Plex defined variable
- The sequence of all variables in Plex has to be the same in the EDIT FUNCTION PARAMETERS in 2E
- Best practice is to define and use a standard parameter structure for 2E calls
- While using the Plex input variable Plex generates a separate field for each entry. If this is not what you want to get do not use the Plex input variable. Please refer to the Plex manual (Calling AS/400 Programs with API Functions).
- Any 2E parameter with usage 'Neither' has to be defined in Plex also because they exists in the generated 2E function
- In the "Edit Function Parameter" screen of 2E parameter passed as RCD have to be placed above those passed as FLD. This is because Plex generates parameters in this order regardless of the sequence of the definition.
Calling a 2E-Function with Java
While calling a 2E function from Plex please be aware that the environment variables are not supported in Plex by default. You might get a NullPointerExeption if you use the *ReturedStatus
A good practice might be to use a base function "FunctionShells.=Call 2e FunctionShell" where the 2E return code will be checked and passed back while calling your 2E function