-
Notifications
You must be signed in to change notification settings - Fork 1
/
TRICORDER
294 lines (232 loc) · 6.51 KB
/
TRICORDER
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
* Raddy 17 Mar 2018
SUBROUTINE TRICORDER
$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.FILE.CONTROL
$INSERT I_F.STANDARD.SELECTION
EXECUTE "COMO ON TRICORDER"
MODE.VERBOSE = "OFF"
GOSUB INIT
GOSUB PROG.LOOP
EXECUTE "COMO OF TRICORDER"
RETURN
PROG.LOOP:
Y.OPT = ""
LOOP WHILE Y.OPT NE "X"
CRT
CRT "TRICORDER [A]LL/[T]able/[R]ecord/[F]ield/[S]how List/e[X]it/[V]erbose is " : MODE.VERBOSE : ") : "
INPUT Y.OPT
Y.OPT = UPCASE(Y.OPT)
TXVB = "Option selected : " : Y.OPT
GOSUB VERBOSE.MODE
BEGIN CASE
CASE Y.OPT[1,1] EQ "A"
GOSUB READ.SL
CASE Y.OPT[1,1] EQ "T"
GOSUB READ.SL
CASE Y.OPT[1,1] EQ "R"
GOSUB READ.SL
CASE Y.OPT[1,1] EQ "F"
GOSUB READ.SL
CASE Y.OPT[1,1] EQ "S"
GOSUB SHOW.LIST
CASE Y.OPT[1,1] EQ "V"
IF MODE.VERBOSE EQ "ON" THEN
MODE.VERBOSE = "OFF"
END ELSE
MODE.VERBOSE = "ON"
END
CRT "Verbose Mode " : MODE.VERBOSE
END CASE
REPEAT
RETURN
INIT:
FN.FILE.CONTROL = 'F.FILE.CONTROL'
F.FILE.CONTROL = ''
CALL OPF(FN.FILE.CONTROL,F.FILE.CONTROL)
FN.STANDARD.SELECTION = 'F.STANDARD.SELECTION'
F.STANDARD.SELECTION = ''
CALL OPF(FN.STANDARD.SELECTION,F.STANDARD.SELECTION)
RETURN
SHOW.LIST:
Y.OPT = Y.OPT[2,1]
TXVB = "Show List : " : Y.OPT
GOSUB VERBOSE.MODE
READLIST Y.SAVED.LIST FROM "TRICORDER.SL" ELSE STOP
SUMMARY.TOTAL = DCOUNT(Y.SAVED.LIST, @FM)
TXVB = "List has been Loaded : " : SUMMARY.TOTAL
GOSUB VERBOSE.MODE
**LOOP
** WHILE READNEXT Y.TRIC FROM Y.SAVED.LIST DO
FOR II = 1 TO SUMMARY.TOTAL
Y.TRIC = Y.SAVED.LIST<II>
Y.OPER = FIELD(Y.TRIC, "|", 1)
Y.TABLE.NAME = FIELD(Y.TRIC, "|", 2)
Y.RECORD.NAME = FIELD(Y.TRIC, "|", 3)
Y.FIELD.NAME = FIELD(Y.TRIC, "|", 4)
Y.EXPECTED.VALUE = FIELD(Y.TRIC, "|", 5)
Y.REMARK = FIELD(Y.TRIC, "|", 6)
BEGIN CASE
CASE Y.OPER EQ "TABLE.ISEMPTY"
IF Y.OPT = "A" OR Y.OPT = "T" THEN
CRT Y.TRIC
END
CASE Y.OPER EQ "RECORD.EXIST"
IF Y.OPT = "A" OR Y.OPT = "R" THEN
CRT Y.TRIC
END
CASE Y.OPER EQ "FIELD.TEST"
IF Y.OPT = "A" OR Y.OPT = "F" THEN
CRT Y.TRIC
END
END CASE
**REPEAT
NEXT
RETURN
READ.SL:
TXVB = "ASSERT : " : Y.OPT
GOSUB VERBOSE.MODE
IF ISALNUM(Y.OPT[2]) THEN
Y.OPT.NUM = Y.OPT[2]
TXVB = "Processing only first : " : Y.OPT.NUM : " records"
GOSUB VERBOSE.MODE
END
READLIST Y.SAVED.LIST FROM "TRICORDER.SL" ELSE STOP
SUMMARY.TOTAL = DCOUNT(Y.SAVED.LIST, @FM)
TXVB = "List has been Loaded : " : SUMMARY.TOTAL
GOSUB VERBOSE.MODE
Y.REC = 0
**LOOP
** WHILE READNEXT Y.TRIC FROM Y.SAVED.LIST DO
FOR II = 1 TO SUMMARY.TOTAL
Y.TRIC = Y.SAVED.LIST<II>
Y.OPER = FIELD(Y.TRIC, "|", 1)
Y.TABLE.NAME = FIELD(Y.TRIC, "|", 2)
Y.RECORD.NAME = FIELD(Y.TRIC, "|", 3)
Y.FIELD.NAME = FIELD(Y.TRIC, "|", 4)
Y.EXPECTED.VALUE = FIELD(Y.TRIC, "|", 5)
Y.REMARK = FIELD(Y.TRIC, "|", 6)
BEGIN CASE
CASE Y.OPER EQ "TABLE.ISEMPTY"
IF Y.OPT = "A" OR Y.OPT = "T" THEN
GOSUB TABLE.ISEMPTY
END
CASE Y.OPER EQ "RECORD.EXIST"
IF Y.OPT = "A" OR Y.OPT = "R" THEN
GOSUB RECORD.EXIST
END
CASE Y.OPER EQ "FIELD.TEST"
IF Y.OPT = "A" OR Y.OPT = "F" THEN
GOSUB FIELD.TEST
END
END CASE
IF Y.RESULT THEN Y.DETAIL.RESULT<-1> = Y.TRIC : "|" : Y.RESULT
IF II GE Y.OPT.NUM THEN CONTINUE
**REPEAT
NEXT
**GOSUB PRINT.DETAIL
GOSUB PRINT.SUMMARY
RETURN
TABLE.ISEMPTY:
R.FC = ""
R.SS = ""
Y.RESULT = ""
CALL F.READ(FN.FILE.CONTROL, Y.TABLE.NAME, R.FC, F.FILE.CONTROL, ERR)
CALL F.READ(FN.STANDARD.SELECTION, Y.TABLE.NAME, R.SS, F.STANDARD.SELECTION, ERR)
IF R.FC AND R.SS THEN
SEL.CMD = "SELECT F." : Y.TABLE.NAME
SEL.LIST = ""
**CALL EB.READLIST(SEL.CMD, SEL.LIST, SEL.LIST.NAME, REC.COUNT, RETURN.ERROR)
READLIST SEL.LIST FROM Y.TABLE.NAME ELSE STOP
IF SEL.LIST THEN
Y.RESULT = ""
END ELSE
Y.RESULT = "TABLE EMPTY"
GOSUB SUMMARIZE
END
END ELSE
Y.RESULT = "TABLE NOT FOUND"
GOSUB SUMMARIZE
END
F.FILE.CONTROL = ""
F.STANDARD.SELECTION = ""
SEL.LIST = ""
RETURN
RECORD.EXIST:
GOSUB TABLE.ISEMPTY
CRT "Y.RESULT = " : Y.RESULT
IF Y.RESULT EQ "" THEN
FN.TAB = "F." : Y.TABLE.NAME
CRT "FN.TAB = " : FN.TAB
F.TAB = ""
R.TAB = ""
**CALL F.READ(FN.TAB, Y.RECORD.NAME, R.TAB, F.TAB, ERR)
CRT "R.TAB = " : R.TAB
IF R.TAB THEN
Y.RESULT = ''
CRT "Y.RESULT = " : Y.RESULT
END ELSE
Y.RESULT = "RECORD NOT FOUND"
CRT "Y.RESULT = " : Y.RESULT
GOSUB SUMMARIZE
END
F.TAB = ""
END
RETURN
FIELD.TEST:
GOSUB RECORD.EXIST
IF Y.RESULT EQ "" THEN
GOSUB GET.FIELD.POSITION
LOCATE Y.EXPECTED.VALUE IN R.TAB<Y.FIELD.NAME.POS> SETTING Y.SUB.POS THEN ELSE
Y.RESULT = "VALUE NOT AS EXPECTED"
GOSUB SUMMARIZE
END
END
RETURN
* GET FIELD POSITION OF Y.FIELD.NAME FROM SS TABLE
GET.FIELD.POSITION:
LOCATE Y.FIELD.NAME IN R.SS<SSL.SYS.FIELD.NAME> SETTING SS.POS THEN
Y.FIELD.NAME.POS = R.SS<SSL.SYS.FIELD.NO, SS.POS>
END
RETURN
SUMMARIZE:
SUMMARY.FOUND += 1
Y.REMARK.1 = ""
IF Y.REMARK EQ "" THEN
Y.REMARK.1 = "Remark empty : Table " : Y.TABLE.NAME : " " : Y.FIELD.NAME
END ELSE
Y.REMARK.1 = Y.REMARK
END
LOCATE Y.REMARK.1 IN REMARK.LIST SETTING REMARK.POS THEN ELSE
REMARK.LIST<-1> = Y.REMARK.1
END
RETURN
PRINT.DETAIL:
CRT STR("-",50)
CRT "DETAIL REPORT"
CRT STR("-",50)
CRT CHANGE(Y.DETAIL.RESULT, @FM, CHAR(10))
RETURN
PRINT.SUMMARY:
Y.PCT1 = (SUMMARY.TOTAL - SUMMARY.FOUND) / SUMMARY.TOTAL * 100
Y.PCT2 = SUMMARY.FOUND / SUMMARY.TOTAL * 100
REMARK.LIST = CHANGE(REMARK.LIST,@FM,CHAR(10))
CRT STR("-",50)
CRT "SUMMARY"
CRT STR("-",50)
CRT "TOTAL CHECKED : " : SUMMARY.TOTAL : " ( 100 % )"
CRT "TOTAL PASSED : " : SUMMARY.TOTAL - SUMMARY.FOUND : " ( " : FMT(Y.PCT1, "L0") : " % )"
CRT "PROBLEMS FOUND : " : SUMMARY.FOUND : " ( " : FMT(Y.PCT2, "L0") : " % )"
CRT STR("-",50)
CRT "RECOMMENDATION : "
CRT STR("*",50)
CRT REMARK.LIST
CRT STR("*",50)
RETURN
VERBOSE.MODE:
IF MODE.VERBOSE EQ "ON" THEN
CRT TXVB
END
TXVB = ""
RETURN
END