If you choose the option to Evaluate / set by call to RDMLX function, (or the equivalent for an RDML function) then it is your responsibility to create and deploy or install the specified LANSA function that will evaluate (and set) your system property's value.
- We advise creating fully RDMLX enabled functions. (RDML functions may be used, for backwards compatibility, but some differences in the interface apply – see below for details.)
- Your function must be defined with function options(*direct).
- Your function must be created and compiled at a LANSA level that is compatible with the version of LANSA Composer that you are using.
- Your function must be deployed to the partition module library for the LANSA system and partition in which LANSA Composer is installed on your LANSA Composer server (for example LICLICLIB).
When LANSA Composer calls your function to evaluate or set a system property value, it will communicate with it using the LANSA exchange list. Specifically, your function must define (if necessary) and use the following fields to identify the request and to return the result. In the case of fields that are indicated to be output variables, your function must use the EXCHANGE command to place them on the LANSA exchange list before returning.
Name | Description | Type | Usage |
|---|---|---|---|
DXREQUES | Request code. LANSA Composer will set this to one of the following values: 'GET' - indicates the function should evaluate the specified system property and place its value in field DXSPVL 'SET' - indicates the function should set the value of the specified system property using the value provided in field DXSPVL. | A(10) | Input |
DXSPID | System property identifier. Your function may be used to evaluate or set the values of more than one system property. If you design your solution in this way, your function will need to test this value (and/or the DXSPII field value) to determine which system property it is being requested to evaluate or set. | A(20) | Input |
DXSPII | System property internal identifier. This is a unique internal identifier that LANSA Composer assigns to each system property definition. | A(32) | Input |
DXSPVL | System property value. For a GET request, your function must set the value of this field to contain the evaluated value of the specified system property. For a SET request, your function should set the value of the specified system property using the value provided in this field. | String(1024) | Input (SET) Output (GET) |
DXRESULT | Result code. If your function completes normally, its should set the value of this field to 'OK'. If the result code contains any other value, LANSA Composer will assume that the evaluation request failed and will not use the returned system property value. | A(2) | Output |
Differences for RDML Functions
Database changes in LANSA Composer version 6.0 necessitated a change to the definition of field DXSPVL. In LANSA Composer version 5.0 and earlier it was defined as A(256) – now it is a string with maximum length 1024.
Existing RDML (and RDMLX) evaluation functions created and compiled using the earlier definition will continue to function correctly in version 6.0 (providing values longer than 256 are not used). However, before you rebuild the function, some source-level changes may be required. These notes also apply if you are creating new RDML evaluation functions (but you are advised to use RDMLX for all new implementations).
If you are using the repository field definitions supplied with LANSA Composer, the new definition of field DXSPVL is incompatible with use in RDML functions.
- If your function is processing a GET request then it must place the resulting value on the exchange list using the EXCHANGE_ALPHA_VAR built-in function. For example:
case of_field(#DXREQUES)
when value_is('= ''GET''')
change field(#DXSPVL256) to('''My system property value''')
change field(#DXRESULT) to('''OK''')
exchange fields(#DXRESULT)
use builtin(exchange_alpha_var) with_args('DXSPVL' #dxspvl256)
…
endcase
- If your function is processing a SET request, then it must define field DXSPVL256 as A(256) to receive the system property value. LANSA Composer places both DXSPVL and DXSPVL256 onto the exchange list before calling your function in this case.
If you are not using the repository field definitions supplied with LANSA Composer, then you should simply make sure that your function defines field DXSPVL as A(256).
Example RDMLX Function
The following is an example RDMLX function to evaluate (and set) a system property named MY_PROPERTY.
function options(*direct)
* ---------------------------------------------------------------------------
* Program mainline
* ---------------------------------------------------------------------------
case of_field(#dxspid)
when value_is(= 'MY_PROPERTY')
case of_field(#dxreques)
when value_is(= 'GET')
#dxspvl := 'MY_PROPERTY_VALUE'
#dxresult := 'OK'
exchange fields(#dxspvl #dxresult)
when value_is(= 'SET')
* MY_PROPERTY is NOT intended to be writeable
#dxresult := 'ER'
exchange fields(#dxresult)
abort msgtxt('System property MY_PROPERTY not writeable')
endcase
otherwise
abort msgtxt('System property name not recognised by this function')
endcase
return