Kbase 20544: How to Troubleshoot TranMan Issues.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  6/30/2005 |
|
Status: Verified
GOAL:
How to troubleshoot TranMan issues.
FACT(s) (Environment):
Translation Manager
FIX:
Translation Manager works with data that is saved in a project database. Like any other application, needs correct data from the project database to work correctly.
There are several reasons why the data may become incorrect:
- Changes in the TranMan code between versions.
- Bugs.
- Bug fixes.
- Incorrect use of the application, etc.
The following contains procedures that report and correct some problems. Before you use the code below to modify the data, be sure to backup the project database and verify the results:
How to run the code (after you back up your project
database):
The utilities are independent of each other and you can run
any of them in any order. One possible way to execute the
utilities is to connect the project database <tmproject>
with logical name 'xlatedb' and run the following code from
the procedure editor:
%DLC%\bin\prowin32 -db <tmproject> -ld xlatedb -1
Procedure tmstrins.p:
The code reports duplicate strings in a project. Along with
duplicate strings, the compiled and translated code might
display original (non-translated) strings for some
instances. This procedure repairs this problem and deletes
the redundant strings.
Procedure tmnum.p:
In some cases the system error:
SE (132) ** XL_instance already exists with
<field/value...>
can occur during data load. This might happen because of
incorrect values of internal counters of sequences and
instances. This code fixes the problem.
Procedure tmproc.p:
The code updates the number of procedures in a project. If
data (.d) files are loaded into a new project database, the
incorrect number causes the TM interface to be disabled.
/* ================ CODE SECTION ================= */
/* tmstrinst.p: */
/* ============ */
/* buffers to search for string, instances and translations */
DEFINE BUFFER bXlString FOR xl_string_info.
DEFINE BUFFER bXlInst FOR xl_instance.
DEFINE VARIABLE lDsp AS LOGICAL NO-UNDO.
DEFINE VARIABLE NextString AS INTEGER NO-UNDO.
DEFINE VARIABLE NextInstance AS INTEGER NO-UNDO.
DEFINE VARIABLE NextStr AS INTEGER NO-UNDO.
DEFINE VARIABLE NextInst AS INTEGER NO-UNDO.
R>DEFINE VARIABLE AssignString AS INTEGER NO-UNDO.
DEFINE VARIABLE iLngth AS INTEGER NO-UNDO.
DEFINE VARIABLE iinstnum AS INTEGER NO-UNDO.
/* get the correct next instance and next sequence numbers */
FIND FIRST XL_Project NO-LOCK NO-ERROR.
IF NUM-ENTRIES(XL_Project.DisplayType,CHR(4)) > 1 THEN
DO:
ASSIGN
NextString = INTEGER(ENTRY(2, XL_Project.DisplayType, CHR(4)))
NextInstance = INTEGER(ENTRY(3, XL_Project.DisplayType, CHR(4)))
NextString = IF NextString = ? THEN 1 ELSE NextString
NextInstance = IF NextINstance = ? THEN 1 ELSE NextInstance.
END.
DO:
FIND LAST XL_String_Info USE-INDEX Sequence_Num NO-LOCK NO-ERROR.
FIND LAST XL_Instance USE-INDEX Instance_Num NO-LOCK NO-ERROR.
ASSIGN
NextInst = IF AVAILABLE XL_Instance
THEN XL_Instance.Instance_Num + 1
ELSE 1
NextStr = IF AVAILABLE XL_String_Info
THEN XL_String_Info.Sequence_Num + 1
ELSE 1.
END.
ASSIGN NextString = MAX(NextString, NextStr)
NextInstance = MAX(NextInstance, NextInst).
/* produce a report */
OUTPUT TO report.txt.
/* go through all the xl_string_info entries */
FOR EACH xl_string_info NO-LOCK USE-INDEX sequence_num:
ASSIGN lDsp = YES
AssignString = xl_string_info.sequence_num.
/* Search for duplicate xl_string_info records;
they are duplicate if original and key strings of two
xl_string_info
records are equal */
loop:
FOR EACH bXlString
WHERE bXlString.keyOfString BEGINS xl_string_info.keyOfString
AND bXlString.Original_string = xl_string_info.Original_string
AND bXlString.sequence_num > xl_string_info.sequence_num:
/* we have a duplicate - but we must compare extended characters
as "a" = "ä"; in V9+ we can use COMPARE(),
but this works for all versions */
DO iLngth = 1 TO LENGTH (RIGHT-TRIM(xl_string_info.keyofstring)):
IF ASC(SUBSTRING(xl_string_info.keyofstring, iLngth, 1)) <>
ASC(SUBSTRING(bxlstring.keyofstring, iLngth, 1))
THEN LEAVE.
END.
IF iLngth > LENGTH (RIGHT-TRIM(xl_string_info.keyofstring))
THEN DO:
/* display the original string, it's instances & translations */
IF lDsp THEN DO:
ASSIGN lDsp = NO.
PUT
"STRING: Seq#:" . SPACE
xl_string_info.sequence_num FORMAT '>>>>>9' SPACE
"Length:" SPACE
LENGTH (xl_String_info.keyOfString) FORMAT '>>>9' SPACE
xl_string_info.KeyOfString AT 9 SKIP
"INSTANCES:" TO 13 SKIP.
FOR EACH xl_instance OF xl_string_info:
PUT
"Seq#:" TO 13 SPACE
xl_instance.sequence_num FORMAT '>>>>>9' SPACE
"Length:" SPACE
XL_Instance.MaxLength FORMAT '>>>9' SPACE
"Inst#:" SPACE
xl_instance.instance_num FORMAT '>>>>>9' SPACE
"Just:" SPACE
xl_instance.Justification FORMAT '9' SPACE
"#Occ:" SPACE
xl_instance.Num_Occurs &.nbsp; FORMAT '>>9' SPACE
xl_instance.proc_name SKIP.
FOR EACH xl_translation WHERE
xl_translation.sequence_num = xl_instance.sequence_num AND
xl_translation.instance_num = xl_instance.instance_num:
PUT xl_translation.trans_string AT 9 SKIP.
END. /* FOR EACH xl_translation */
END. /* FOR EACH xl_instance */
END. /* IF lDsp THEN ... */
/* display the duplicate string, it's instances, translations */
PUT
"DUPL. STR:" TO 13 SPACE
bXlstring.sequence_num FORMAT '>>>>>9' SPACE
"Length:" SPACE
LENGTH (bXlstring.keyOfString) FORMAT ">>>9" SPACE
bXlstring.keyOfString AT 9.
FOR EACH xl_instance OF bXlstring:
PUT
"Seq#:" TO 13 SPACE
xl_instance.sequence_num FORMAT '>>>>>9' SPACE
"Length:" SPACE
XL_Instance.MaxLength FORMAT '>>>9' SPACE
"Inst#:" SPACE
xl_instance.instance_num FORMAT '>>>>>9' SPACE
"Just:"  .; SPACE
xl_instance.Justification FORMAT '9' SPACE
"#Occ:" SPACE
xl_instance.Num_Occurs FORMAT '>>9' SPACE
xl_instance.proc_name SKIP.
/* can we find an existing instance of the new parent? */
FIND FIRST bxlInst WHERE
bxlinst.sequence_num = xl_string_info.sequence_num AND
bxlinst.Justification = xl_instance.Justification AND
bxlinst.MaxLength = xl_instance.MaxLength AND
bxlinst.proc_name = xl_instance.proc_name
EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE bXlinst THEN iinstnum = bXlInst.instance_num.
ELSE iinstnum = ?. /* No, we cannot */
FOR EACH xl_translation WHERE
xl_translation.sequence_num = xl_instance.sequence_num AND
xl_translation.instance_num = xl_instance.instance_num:
PUT xl_translation.trans_string AT 9 SKIP.
/* we have to change the translation */
IF iinstnum = ? THEN
ASSIGN xl_translation.sequence_num =
xl_string_info.sequence_num
xl_translation.instance_num = NextInstance
/* should find a translation of the original instance and
assign this one if it did not exist; the translation may
be lost here */.
ELSE DELETE xl_translation.
END. /* FOR EACH xl_translation */
&n.bsp; /* we have to change seq_num and inst_num of the instance */
IF iinstnum = ? THEN
ASSIGN xl_instance.sequence_num =
xl_string_info.sequence_num
xl_instance.instance_num = NextInstance
nextInstance = NextInstance + 1.
ELSE DO:
ASSIGN bXlinst.Num_Occurs = bXlinst.num_occurs + 1.
DELETE xl_instance.
END.
END. /* FOR EACH xl_instqance OF bXlString */
/* get rid of the duplicate - we need NO-ERROR here as the
record could be deleted by db trigger */
DELETE bXlString NO-ERROR.
PUT SKIP (1).
END. /* IF LENGTH ... */
END. /* FOR EACH bXlString */
END. /* FOR EACH xl_String_info */
/* update the counters of sequence and instance */
DO TRANSACTION:
FIND FIRST xl_project EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE xl_project THEN
ASSIGN
XL_Project.DisplayType =
IF NUM-ENTRIES(XL_Project.DisplayType,CHR(4)) > 1 THEN
ENTRY(1,XL_Project.DisplayType,CHR(4))
+ CHR(4) + TRIM(STRING(NextString))
+ CHR(4) + TRIM(STRING(NextInstance))
ELSE
XL_Project.DisplayType
+ CHR(4) + TRIM(STRING(NextString))
+ CHR(4) + TRIM(STRING(NextInstance)).
END.
OUTPUT CLOSE.
/* tmstrinst.p - end */
/* tmnum.p */
/* ======= */
FIND FIRST XL_Project NO-LOCK NO-ERROR.
IF NUM-ENTRIES(XL_Project.DisplayType,CHR(4)) > 1 THEN
DO:
ASSIGN
NextString = INTEGER(ENTRY(2, XL_Project.DisplayType, CHR(4)))
NextInstance = INTEGER(ENTRY(3, XL_Project.DisplayType, CHR(4)))
NextString = IF NextString = ? THEN 1 ELSE NextString
NextInstance = IF NextINstance = ? THEN 1 ELSE NextInstance.
END.
DO:
FIND LAST XL_String_Info USE-INDEX Sequence_Num NO-LOCK NO-ERROR.
FIND LAST XL_Instance USE-INDEX Instance_Num NO-LOCK NO-ERROR.
ASSIGN
NextInst = IF AVAILABLE XL_Instance
THEN XL_Instance.Instance_Num + 1
ELSE 1
NextStr = IF AVAIL.ABLE XL_String_Info
THEN XL_String_Info.Sequence_Num + 1
ELSE 1.
END.
ASSIGN NextString = MAX(NextString, NextStr)
NextInstance = MAX(NextInstance, NextInst).
DO TRANSACTION:
FIND FIRST xl_project EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE xl_project THEN
ASSIGN
XL_Project.DisplayType =
IF NUM-ENTRIES(XL_Project.DisplayType,CHR(4)) > 1 THEN
ENTRY(1,XL_Project.DisplayType,CHR(4))
+ CHR(4) + TRIM(STRING(NextString))
+ CHR(4) + TRIM(STRING(NextInstance))
ELSE
XL_Project.DisplayType
+ CHR(4) + TRIM(STRING(NextString))
+ CHR(4) + TRIM(STRING(NextInstance)).
END.
/* tmnum.p - end */
/* tmproc.p */
/* ======== */
DEFINE VARIABLE iNumProcs AS INTEGER NO-UNDO.
FOR EACH xl_procedure NO-LOCK:
iNumProcs = iNumProcs + 1.
END.
FIND FIRST xl_project NO-ERROR.
IF AVAILABLE xl_project THEN
xl_project.NumberOfProcedures = iNumProcs.
/* tmproc.p - end */
.