In some cases you have to catch the marking list, because e.g. another selection to the table has to be made short-dated. For this purpose EASY has the functions »getmarks« and »putmarks«. These functions can be called with different arguments:
VAR marks : MARKS
getmarks(db,marks) // saves the marking list of db in marks
putmarks(db,marks) // restores the saved marking list
Tip: putmarks overwrites the actual marking list of db.
The data type MARKS can only be used by these two functions. The big advantage to use a variable of the type MARKS is
* only the really needed size of memory is used
* the sorting within the marking list is kept
But the marking list can also be saved in an INTEGER or REAL array. Here the programmer has to make sure that the REAL array has enough elements to save the whole list:
VAR marks : INTEGER
After »getmarks(db,marks)« in »marks« there are the physical record numbers of the marking list. Here a procedure where the marking list is saved in an external text file:
PROCEDURE SaveMarks(db : INTEGER);
VAR text,i : INTEGER;
VAR marks : INTEGER;
IF text:=rewrite('marks_save') THEN
Also the use of »getmarks« and »putmarks« with a REAL array keeps the order. The advantage is that the record numbers are there immediately handy and manipulable.
Finally there is the possibility to use a variable of the type TBITS. To work correctly this field has to dimensioned that the it can map whole table:
VAR marks : TBITS
Here is after »getmarks(db,marks)«, that
* marks[x]=1 if the record with the number x is in the marking list
* marks[x]=0 otherwise
Thus »marks« is a image of the subset of the table that is specified by the marking list. And as with every set the orders is lost! First of all the advantage of the use of TBITS is that with the functions
the most important set operations can be performed very efficiently. All three functions return the cardinality (number of 1) of »b_field_1« after the particular operation.
bitand: b_feld1 := b_feld1 intersected with b_feld2
bitor: b_feld1 := b_feld1 merged with b_feld2
bitandnot: b_feld1 := b_feld1 intersected with the compliment of b_feld2 (difference in quantities)
Working with the datatype TBITS is so efficient, that for example the fulltext search accesses basically to it(»markbits«).
You will always use it if more than one - logical linked - selections to a table are executed.