Kbase 15948: AS/400: Check for Indexes out of Order w/in the P__INDEX File
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  15/10/2008 |
|
Status: Verified
FACT(s) (Environment):
Progress/400 DataServer
SYMPTOM(s):
How to verify that the indexes within P__index file are out of order?
Client is getting a GPF after having indices deleted from the server schema
FIX:
Use SQL to look at the file.
Type STRSQL on the AS/400 command line press enter, at the Enter SQL Statement screen, enter:
select * from libraryname/P__index ORDER BY filenumber, idxnum
When the data is displayed, there will be headings on each field. Within the FILENUMBER column, the IDXNUM numbers should be in sequential and contiguous order starting with 1 (one). If they are not, the index's must be renumbered.
The following procedure can be run from the Client Schema holder:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.
DEFINE VARIABLE re-nbr AS LOGICAL INITIAL FALSE NO-UNDO.
FOR EACH p__file:
ASSIGN i = 0
j = 0.
FOR EACH P__index WHERE p__index._file-number = p__file._File-number:
ASSIGN i = i + 1.
IF p__index._idx-num > j THEN
ASSIGN j = p__index._Idx-num.
END.
IF j > i THEN DO:
ASSIGN i = 1.
_idx-loop:
FOR EACH p__index WHERE p__index._file-number = p__file._File-number
BY p__index._Idx-num:
IF p__index._Idx-num = i THEN DO:
ASSIGN i = i + 1.
NEXT _idx-loop.
END.
ELSE DO:
FOR EACH p__Idxfd WHERE p__Idxfd._Idx-num = p__Index._Idx-num
AND p__Idxfd._File-number =
p__Index._File-number:
ASSIGN p__Idxfd._Idx-num = i.
END.
IF p__File._fil-misc1[7] = p__Index._Idx-num THEN
ASSIGN p__File._fil-misc1[7] = i.
IF p__File._Fil-Res1[2] < i THEN
ASSIGN p__File._Fil-Res1[2] = i.
IF p__File._Prime-Index = p__Index._Idx-num THEN
ASSIGN p__File._Prime-Index = i.
IF ABSOLUTE(p__File._Fil-Res1[7]) = p__Index._Idx-num THEN
ASSIGN p__File._Fil-Res1[7] = ( i * -1).
ASSIGN p__Index._Idx-num = i
p__File._fil-Misc1[1] = p__file._Fil-Misc1[1] + 1.
i = i + 1.
END.
END.
IF re-nbr = FALSE THEN DO:
FIND _File WHERE _File._File-name = "p__File".
FIND _DB WHERE RECID(_Db) = _File._Db-recid.
ASSIGN _Db._Db-Misc1[1] = ?
re-nbr = TRUE.
END.
END.
END.
Once the procedure has been run, you will need to re-build all schema holders that use the dictionary library that was updated.