148 lines
8.1 KiB
Plaintext
148 lines
8.1 KiB
Plaintext
Compile Insert IDX_SETS.EQU
|
|
!
|
|
* $INSERT record for R/BASIC callers of the IDX_SETS function
|
|
*
|
|
*
|
|
* IDX_SETS is a function that performs union, intersection and difference
|
|
* of delimited sets of row data. The function has 9 calling modes that
|
|
* allow it to create, add data to, intersect, union, differnce, extract
|
|
* data from, and clear sets. The parameters for each calling mode are
|
|
* specific to the calling mode, but basically the use of IDX_SETS is:
|
|
*
|
|
* return_parm = IDX_SETS(mode, parm_1,...parm_n)
|
|
!
|
|
* MrC 06-20-16 Added header guards
|
|
* rjc 05-21-09 Copied to SYSPROCS
|
|
!
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
#ifndef _IDX_SETS_EQU_
|
|
#define _IDX_SETS_EQU_
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
!
|
|
* Calling modes
|
|
!
|
|
EQU INIT_SET$ TO 1 ;* Initializes a set returning a
|
|
* set_handle (a positive integer) or
|
|
* an error code (a negative integer).
|
|
* Parameters are: the data, the
|
|
* "specification", and the map
|
|
|
|
EQU ADD_TO_SET$ TO 2 ;* Adds data to an existing set. Returns
|
|
* 0 on successful completion or an
|
|
* an error code (a negative integer).
|
|
* Parameters are: the data, and the
|
|
* handle of the set to add to
|
|
|
|
EQU UNION_SETS$ TO 3 ;* Performs the union of two sets
|
|
* returning a set_handle (a positive
|
|
* integer) or an error code (a
|
|
* negative integer).
|
|
* Parameters are: the 1st handle, the
|
|
* 2nd handle, and the union spec
|
|
|
|
EQU INTERSECT_SETS$ TO 4 ;* Performs the intersection of two
|
|
* sets returning a set_handle (a
|
|
* positive integer) or an error code
|
|
* (a negative integer).
|
|
* Parameters are: the 1st handle, the
|
|
* 2nd handle, and the intersect spec
|
|
|
|
EQU DIFFERENCE_SETS$ TO 5 ;* Performs the difference of two
|
|
* sets returning a set_handle (a
|
|
* positive integer) or an error code
|
|
* (a negative integer).
|
|
* Parameters are: the 1st handle, the
|
|
* 2nd handle, and the intersect spec
|
|
|
|
EQU RESET_EXTRACT$ TO 6 ;* Sets the extract parameters (restart
|
|
* the extract or set for desc. extract)
|
|
* Parameters are: the handle, and
|
|
* a reset specification
|
|
|
|
EQU EXTRACT_FROM_SET$ TO 7 ;* Extracts row data from a set. Returns
|
|
* 1 if more data exists in the set, 0
|
|
* if all data has been extracted, or
|
|
* an error code (a negative integer).
|
|
* Parameter is: the handle. A 3rd
|
|
* variable is passed, it is filled
|
|
* with data by Set_Lib on "no error".
|
|
|
|
EQU SET_INFO$ TO 8 ;* Reports data about a set.
|
|
* Parameter is: the handle. Set_Lib
|
|
* returns the count of all rows in the
|
|
* 3rd variable, the count of index
|
|
* rows in the 4th variable and the
|
|
* MODEFLAGS variable from the handle
|
|
* in the 5th variable.
|
|
|
|
EQU CLEAR_SET$ TO 9 ;* Clears a set_handle from the library's
|
|
* storage. Returns 0 always.
|
|
|
|
!
|
|
* Error codes
|
|
!
|
|
|
|
EQU ERR_BAD_MODE$ TO -1 ;* Returned if calling mode is not a
|
|
* positive integer >= 1 and <= 9.
|
|
EQU ERR_OUT_OF_HANDLES$ TO -2 ;* IDX_SETS supports up to 7 active sets.
|
|
* This error is returned when modes
|
|
* 1, 3, or 4 cannot create a necessary
|
|
* set. Clear and recall.
|
|
EQU ERR_BAD_MAP$ TO -3 ;* Returned by mode 1 when the map to a
|
|
* set is bad.
|
|
EQU ERR_BAD_SET_STR$ TO -4 ;* Returned by modes 1 and 2 when the
|
|
* set data passed is corrupt (missing
|
|
* a trailing record mark).
|
|
EQU ERR_FILE_IO$ TO -5 ;* Returned by modes 1, 2, 3, 4, and 5
|
|
* if an error occurs in support file
|
|
* I/O. There is nothing you can do
|
|
* at this point but blow away the set
|
|
* and start again. The most common
|
|
* sources for this error are: 1) the
|
|
* user's sort path has become corrupt;
|
|
* and 2) the user is out of disk space.
|
|
EQU ERR_OUT_OF_MEM$ TO -6 ;* Returned by modes 1, 3, 4 or 5 when
|
|
* not enough memory for operation.
|
|
EQU ERR_BAD_HANDLE$ TO -7 ;* Returned by modes 2, 3, 4, 5 when a
|
|
* handle parameter is no good.
|
|
EQU ERR_BAD_SRC_HANDLE$ TO -8 ;* Returned by modes 2, 3, 4, 5 when a
|
|
* source handle parameter is no good.
|
|
EQU ERR_BAD_TGT_HANDLE$ TO -9 ;* Returned by modes 2, 3, 4, 5 when a
|
|
* target handle parameter is no good.
|
|
|
|
EQU ERR_NULL_SET$ TO -20 ;* Currently not returned by Set_Lib but
|
|
* used by "wrap around" R/Basic code to
|
|
* indicate that the set is NULL (no rows
|
|
* match requested criteria).
|
|
|
|
|
|
EQU IS_MORE_ROWS$ TO 1 ;* Returned by extract when more rows
|
|
* exist in the set than can be returned
|
|
* by the current call to IDX_SETS.
|
|
EQU IS_NO_MORE_ROWS$ TO 0 ;* Returned by extract when all rows
|
|
* have been returned from the set.
|
|
|
|
EQU IS_ERR_NONE$ TO 0
|
|
|
|
!
|
|
* Intialization specification equates
|
|
!
|
|
EQU IS_NULL_SPEC$ TO 0 ;* No user specification
|
|
EQU IS_SORTED$ TO 2 ;* User set string is already sorted
|
|
EQU IS_UNIQUE$ TO 4 ;* All set items in the user string are
|
|
* unique
|
|
|
|
!
|
|
* Extraction specification equates
|
|
!
|
|
EQU IS_DESC_EXT$ TO 1
|
|
EQU IS_RESET_EXT$ TO 2
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
#endif
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|