Consultor Eletrônico



Kbase P119412: How to find which Storage Area a block number is in ?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   2/3/2010
Status: Verified

GOAL:

How to find which Storage Area a block number is in ?

GOAL:

What could be associated with a block number reported in an error message

GOAL:

SYSTEM ERROR: Attempt to read block <number> which does not exist. (210)

FACT(s) (Environment):

Progress 9.1x
OpenEdge 10.x
All Supported Operating Systems

FIX:

The following example code has proven useful in the past, particularly with the advent of storage areas, in identifying the errant tables/indexes by a known blocknumber out of all possible available.
For example, SYSTEM ERROR: Attempt to read block <number> which does not exist. (210)

Given that the "BLOCKNUMBER" is available, the following 4GL generates a read of every instance of that blocknumber found in every Storage Area that it is found.
It goes without saying that if the blocknumber entered is not the masterblock and not null!
The recid rowid are here purely for search capabilities, they are NOT used at all.


form with frame a down.
def var blkno as int no-undo.
def var recsperblk as int no-undo.
def var testrecid as int no-undo.
def var cnt as int no-undo.
def var rectype as char format "x(30)"no-undo.
def var hquery as handle no-undo.
def var hbuf as handle no-undo.
update blkno with frame info.
for each _area no-lock :
recsperblk = 1.
do cnt = 1 to _area-recbits :
recsperblk = recsperblk * 2.
end.
display _area-name recsperblk with frame info.
do cnt = 0 to recsperblk :
testrecid = blkno + cnt.
rectype = "".
for each _file where _ianum = _area-num no-lock.
create buffer hbuf for table _file-name.
create query hquery.
hquery:add-buffer(hbuf).
hquery:query-prepare("for each " + _file-name + " where recid( " + _file-name + " ) = " + string(testrecid) + " no-lock" ).
hquery:query-open().
hquery:get-first().
if hbuf:available then rectype = _file-name.
delete object hquery no-error.
delete object hbuf no-error.
end.

display blkno cnt rectype with frame a.
down with frame a.
end.
hide frame a.
clear frame a all.
end.