2 System
: Property Management and Finance System
14 DEF INPUT PARAMETER table-name
AS CHAR NO-UNDO.
15 DEF INPUT PARAMETER file-name
AS CHAR NO-UNDO.
17 DEF VAR where-clause
AS CHAR NO-UNDO.
18 DEF VAR index-is-unique
AS LOGI
NO-UNDO INITIAL Yes.
20 /* Create the where clause that constitues the unique find
23 FIND FIRST _File
WHERE _File._File-Name
= table-name
NO-LOCK NO-ERROR.
24 FIND FIRST _Index
WHERE
25 _Index._File-recid
= RECID( _File
) AND
29 IF NOT AVAILABLE _File
THEN DO:
31 "An error occured while loading the" SKIP
32 "replication log. The table" '
"' + table-name + '"'
SKIP
33 "was expected but does not exist !"
34 VIEW-AS ALERT-BOX ERROR TITLE "Replication Error".
38 IF NOT AVAILABLE _Index
THEN DO:
39 MESSAGE "Because there is no unique index for the table" '
"' + _File._File-Name SKIP
40 "there may be additional records in the resulting file as well
" SKIP
41 "as an excessive number of collisions
!" SKIP(1)
42 VIEW-AS ALERT-BOX WARNING TITLE "Replication Warning
".
44 FIND _Index WHERE RECID( _Index ) = _File._Prime-Index NO-LOCK NO-ERROR.
48 FOR EACH _Index-Field NO-LOCK WHERE
49 _Index-Field._Index-RecID = RECID( _Index ),
50 EACH _Field WHERE RECID( _field ) = _Index-Field._Field NO-LOCK:
52 where-clause = where-clause + IF where-clause = "" THEN "" ELSE " AND ".
53 where-clause = where-clause +
54 table-name + ".
" + _Field._Field-Name + " = " +
55 "Repl
" + table-name + ".
" + _Field._Field-Name.
59 OUTPUT TO VALUE( file-name ).
63 'rplctn/loadlog.i "'
+ table-name
+ '
" "'
64 + where-clause
+ '
" "'
65 + STRING(index-is-unique
, "Yes/No") + '
"'
71 COMPILE VALUE( file-name ) SAVE.