The following table shows how to read the _TableStat VST. You will not see any records if the session is not started with a value greater than 0 for -tttablerangesize, or if there are no temp-tables with an ID in the specified range.

Read a _TableStat table


USING Progress.Database.*.
def var hVST as handle.
def var hbVST as handle.
def var hq as handle.
DEF VAR cTableName AS CHAR.
DEF VAR cProc AS CHAR .
hVST = TempTableInfo:GetVSTHandle(VSTTableId:TableStatId).
hbVST = hvst:default-buffer-handle.
create query hq.
hq:set-buffers(hbVST).
hq:query-prepare("for each " + hbVST:name).
hq:query-open().
/* for each _TableStaT record */
repeat:
   hq:get-next().
   /* check if there are no more records */
   if hq:query-off-end then leave.
	     /* check if the id represents a temp-table in scope at this
         time. Calling the overloaded version that returns the temp-table
         name and the procedure name that instantiated the temp-table.
      */
      IF TempTableInfo:GetTableInfoByID(hbVST::_tableStat-Id,
                                        OUTPUT cTableName, OUTPUT cProc) THEN DO:
       /* display some info about the temp-table and the data from the 
         _TableStat table
*/
       DISP cTableName FORMAT "X(20)"
            cProc FORMAT "X(20)" NO-LABEL      
            "Create:" hbVST::_TableStat-Create
            "Update:" hbVST::_TableStat-Update
            "Delete:" hbVST::_TableStat-Delete
            "Read:"   hbVST::_TableStat-Read
            "OSRead:" hbVST::_TableStat-OSRead.
       PAUSE.
     END.
END.