Kbase P2412: How to calculate the highest RECID used in a Storage Area
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Unverified
GOAL:
How to calculate the highest RECID used in a Storage Area
FACT(s) (Environment):
Progress 9.x
FIX:
You have to resort to Virtual System Tables to get to know this piece of information.
In _AreaStatus you have _AreaStatus-Hiwater, which is the highwater mark (the highest block that Progress has used); you have one highwater mark for each storage area.
Unfortunately, that is the block number, not the RECID.
In order to obtain that, you have to multiply the high-water mark number by the number of records per block in the storage area; this piece of information is not int the VST's at all. Instead, you have to run 'prostrct list' against the database, and look at how many records per block each storage area has. In the following excerpt from the structure file:
d "Schema Area":6,32 ./test.d1
#
d "Employee":7,32 ./test_7.d1 f 320
d "Employee":7,32 ./test_7.d2
Storage area 'Schema Area' has 32 records per block, as well as storage area 'Employee'.
Once the number of records per block has been found, you can run the following 4GL program to calculate the highest RECID:
DEF VAR areaName LIKE _AreaStatus._AreaStatus-Areaname.
DEF VAR rpb AS INTEGER FORMAT "ZZ9" LABEL "Recs/block".
REPEAT:
UPDATE areaName rpb.
FIND FIRST _AreaStatus WHERE
_AreaStatus._AreaStatus-Areaname = areaName NO-ERROR.
IF NOT AVAILABLE _AreaStatus THEN DO:
MESSAGE "Area " + areaName + " does not exist." VIEW-AS ALERT-BOX.
NEXT.
END.
DISPLAY _AreaStatus._AreaStatus-Hiwater * rpb LABEL "Highest RECID".
END.