Page History
...
Function No: | 989 |
DLL Required: | U_BIF989.DLL |
For use with
Visual LANSA for Windows | YES |
Visual LANSA for Linux | NO |
LANSA for i | NO |
Arguments
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | A | Req | Type of indexed space operation to be performed. Pass as one of: INSERT Unconditionally insert a new entry into an indexed space. PUT Insert a new or update an existing entry in an indexed space. GET Get an entry from an indexed space. FIRST Get the first entry in an indexed space. NEXT Get the next entry in an indexed space. DESTROY Destroy an indexed space and free associated system resources. Note that this Built-In Function only validates and acts upon the first character of the requested index space operation (i.e. C,I,P,G,F,N,D) but to maximize RDML function readability it is recommended that you use the full words CREATE, INSERT, PUT, GET, FIRST, NEXT and DESTROY. | 1 | 50 | ||
2 | A | Req | Definition string or indexed space, identifier (or handle). An identifier (or handle) is the value returned to you in argument 2 when you create a new indexed space that uniquely identifies the indexed space. When Arg 1 is CREATE The indexed space definition string. See the following information for details of definition strings. any other The identifier (or handle) of the indexed space that is to be used by the requested operation (the identifier or handle is the value returned in return value 2 when a new index space is created. It uniquely identifies the indexed space which you wish to use). | 1 | 256 | ||
3 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
4 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
5 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
6 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
7 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
8 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
9 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
10 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 | ||
11 | A | Opt | Definition string continuation. Only valid for CREATE operations, ignored for other operations. | 1 | 256 |
Return Values
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
1 | A | Req | Standard Return Code | 2 | 2 | ||
2 | A | Opt | Returned indexed space identifier or handle. | 10 | 10 |
Technical Notes
Indexed Spaces and Indexed Space Definition Strings
...
Definition String: deptment key(), deptdes
Can be visualized as :
Department | Department Description |
where DEPTMENT is the single key to each table or grid entry. Note that "deptdesc" adopts the default keyword "data()" in this example.
Definition String : deptment key(), section key(), secdesc
Can be visualized as
Department | Section | Section Description |
where DEPTMENT and SECTION form an aggregate to each table or grid entry. Note that "secdesc" adopts the default keyword "data()" in this example.
Definition String: deptment key(), empasal avg(salary), empxsal max(salary), empmsal min(salary)
Can be visualized as
Department | Average Salary | Maximum Salary | Minimum Salary |
where DEPTMENT is the single key to each table or grid entry.
...
The following sample RDML function uses an indexed space to aggregate details of employee salary information. It uses the standard LANSA demonstration file PSLMST as the basis of employee salary information:
FUNCTION OPTIONS(*LIGHTUSAGE *DIRECT)
********** COMMENT(Departmental Summary definitions)
DEFINE FIELD(#OVTDEPSAL) TYPE(*DEC) LENGTH(15) DECIMALS(2) COLHDG('Total' 'Salary' 'Expenditure') EDIT_CODE(3)
DEFINE FIELD(#OVXDEPSAL) TYPE(*DEC) LENGTH(11) DECIMALS(2) COLHDG('Maximum' 'Salary') EDIT_CODE(3)
DEFINE FIELD(#OVNDEPSAL) TYPE(*DEC) LENGTH(11) DECIMALS(2) COLHDG('Minimum' 'Salary') EDIT_CODE(3)
DEFINE FIELD(#OVADEPSAL) TYPE(*DEC) LENGTH(11) DECIMALS(2) COLHDG('Average' 'Salary') EDIT_CODE(3)
DEFINE FIELD(#OVCDEPSAL) TYPE(*DEC) LENGTH(7) DECIMALS(0) COLHDG('Total' 'Employees') EDIT_CODE(3)
DEFINE FIELD(#OVFDEPSAL) TYPE(*CHAR) LENGTH(256) DECIMALS(0) COLHDG('Indexed' 'Space' 'Definition')
CHANGE FIELD(#OVFDEPSAL) TO('deptment key(), ovtdepsal sum(salary), ovxdepsal max(salary), ovndepsal min(salary), ovadepsal avg(salary), ovcdepsal count()')
DEFINE FIELD(#OVHDEPSAL) TYPE(*CHAR) LENGTH(10) LABEL('Space Handle')
DEF_LIST NAME(#OVSDEPSAL) FIELDS(#DEPTMENT #OVTDEPSAL #OVCDEPSAL #OVXDEPSAL #OVNDEPSAL #OVADEPSAL)
**********
DEFINE FIELD(#OV_RC) TYPE(*CHAR) LENGTH(2) LABEL('Return Code')
********** COMMENT(Create the indexed space)
USE BUILTIN(OV_INDEXED_SPACE) WITH_ARGS(CREATE #OVFDEPSAL) TO_GET(#OV_RC #OVHDEPSAL)
********** COMMENT((Pass over the data and update the summary details')
SELECT FIELDS(#DEPTMENT #SALARY) FROM_FILE(PSLMST)
USE BUILTIN(OV_INDEXED_SPACE) WITH_ARGS(PUT #OVHDEPSAL) TO_GET(#OV_RC)
ENDSELECT
********** COMMENT(Now load/show a browse list with the results)
USE BUILTIN(OV_INDEXED_SPACE) WITH_ARGS(FIRST #OVHDEPSAL) TO_GET(#OV_RC)
DOWHILE COND('#OV_RC = OK')
ADD_ENTRY TO_LIST(#OVSDEPSAL)
USE BUILTIN(OV_INDEXED_SPACE) WITH_ARGS(NEXT #OVHDEPSAL) TO_GET(#OV_RC)
ENDWHILE
DISPLAY BROWSELIST(#OVSDEPSAL)
********** COMMENT(Destroy the indexed space)
USE BUILTIN(OV_INDEXED_SPACE) WITH_ARGS(DESTROY #OVHDEPSAL) TO_GET(#OV_RC)
The following sample RDML function is identical to the previous one except that it uses a second indexed space to aggregate information for all departments and then adds the "grand" aggregates to the end of the aggregate list that is displayed to the user. This demonstrates how indexed spaces can be used to perform multiple level totaling by using multiple indexed spaces:
...