Add %age area column to vacancies section.
[capital-apms-progress.git] / rplctn / mkload.p
blob7abe4cca036407dcab1f116742ca5a281973d5a8
1 /*
2 System: Property Management and Finance System
3 Include: mkload.p
4 Author: Tyrone McAuley
5 Date: 28/08/97
7 Description:
8 Parameters: table-name
9 file-name
11 Modification Notes
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
21 on the given table */
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
26 _Index._Unique
27 NO-LOCK NO-ERROR.
29 IF NOT AVAILABLE _File THEN DO:
30 MESSAGE
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".
35 RETURN "FAIL".
36 END.
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.
45 index-is-unique = No.
46 END.
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.
57 END.
59 OUTPUT TO VALUE( file-name ).
61 PUT UNFORMATTED
62 CHR(123) +
63 'rplctn/loadlog.i "' + table-name + '" "'
64 + where-clause + '" "'
65 + STRING(index-is-unique, "Yes/No") + '"'
66 CHR(125)
67 SKIP.
69 OUTPUT CLOSE.
71 COMPILE VALUE( file-name ) SAVE.