-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixnullchars.prg
223 lines (192 loc) · 3.93 KB
/
fixnullchars.prg
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
CLOSE DATABASES ALL
CLEAR
SET EXCLUSIVE OFF
SET SAFETY OFF
_VFP.CAPTION = "Correcting Null Characters in Various DBF(s)."
PRIVATE curfldname, icus, ivin, ipmt, ihis, m1, dflt_drive
PUBLIC gdbf, gtimeout, eschit, lcont
icus = 0
ivin = 0
ipmt = 0
ihis = 0
ihmt = 0
irmt = 0
irpt = 0
curfldname = ""
dflt_drive = "N:\APPS\ACSS" + SPACE(10)
gdbf = UPPER(ALLTRIM(dflt_drive))
lcont = 1
gtimeout = 600
eschit = .F.
@04,2 SAY "CUSMAS (FCOUNT) = "
@05,2 SAY "VINMAS (FCOUNT) = "
@06,2 SAY "PMAST (FCOUNT) = "
@07,2 SAY "STDETL (FCOUNT) = "
@08,2 SAY "ROMAST (FCOUNT) = "
@09,2 SAY "HMAST (FCOUNT) = "
@10,2 SAY "RECEPT (FCOUNT) = "
@11,2 SAY "CHKREG (FCOUNT) = "
clearbox(12,00,24,79)
@13,2 SAY " Enter directory: "
@13,26 GET dflt_drive PICTURE "@RK! "
KEYBOARD "{END}"
READ TIMEOUT gtimeout
IF time_out() .OR. eschit &&.OR. lcont =2
CLOSE ALL
RETURN .F. && Aborted Input !!!
ENDIF
IF RIGHT(ALLTRIM(dflt_drive),1) <> "\"
dflt_drive =ALLTRIM(dflt_drive) +"\"
ENDIF
gdbf = ALLTRIM(dflt_drive)
SELECT 0
USE gdbf + "cusmas" SHARED ALIAS cus01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
icus = icus + 1
@04,28 SAY icus
NEXT
ON ERROR
USE
curfldname = ""
SELECT 0
USE gdbf + "vinmas" SHARED ALIAS vin01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
IF &curfldname <> "vi_olet"
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
ENDIF
ivin = ivin + 1
@05,28 SAY ivin
NEXT
ON ERROR
USE
curfldname = ""
SELECT 0
USE gdbf + "pmast01" SHARED ALIAS pmt01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
ipmt = ipmt + 1
@06,28 SAY ipmt
NEXT
ON ERROR
USE
curfldname = ""
SELECT 0
USE gdbf + "stdetl" SHARED ALIAS his01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
ihis = ihis + 1
@07,28 SAY ihis
NEXT
ON ERROR
USE
curfldname = ""
SELECT 0
USE gdbf + "romast01" SHARED ALIAS rmt01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
irmt = irmt + 1
@08,28 SAY irmt
NEXT
ON ERROR
USE
curfldname = ""
SELECT 0
USE gdbf + "hmast01" SHARED ALIAS hmt01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
ihmt = ihmt + 1
@09,28 SAY ihmt
NEXT
ON ERROR
USE
curfldname = ""
SELECT 0
USE gdbf + "recept01" SHARED ALIAS rpt01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
irpt = irpt + 1
@10,28 SAY irpt
NEXT
ON ERROR
USE
curfldname = ""
SELECT 0
USE gdbf + "chkreg01" SHARED ALIAS chk01
GO TOP
ON ERROR DO errcheckfield
FOR gncount = 1 TO FCOUNT( )
curfldname = FIELD(gncount)
REPLACE ALL &curfldname WITH STRTRAN(&curfldname,CHR(0)," ")
ichk = ichk + 1
@11,28 SAY ichk
NEXT
ON ERROR
USE
CLOSE DATABASES ALL
@15,2 SAY "The operation(s) is completed."
INKEY(5)
RETURN
PROCEDURE errcheckfield
* Do Nothing and Continue
ENDPROC
FUNCTION clearbox
PARAMETERS x1, y1, x2, y2
PRIVATE i
x1 = ABS(x1)
y1 = ABS(y1)
x2 = ABS(x2)
y2 = ABS(y2)
IF x1 > INT(WROWS(WOUTPUT())) THEN
RETURN
ENDIF
IF y1 > INT(WCOLS(WOUTPUT())) THEN
RETURN
ENDIF
IF x2 > INT(WROWS(WOUTPUT())) THEN
RETURN
ENDIF
IF y2 > INT(WCOLS(WOUTPUT())) THEN
RETURN
ENDIF
FOR i = x1 TO x2 STEP 1
@ i, y1 SAY REPLICATE(" ",ABS(y2-y1+1))
NEXT i
RETURN
ENDFUNC
FUNCTION time_out
PRIVATE esc
IF LASTKEY() =27
eschit =.T.
ENDIF
IF READKEY() = 20 .OR.READKEY() = 276
eschit =.T.
KEYBOARD CHR(27) PLAIN
esc =INKEY()
ELSE
RETURN .F.
ENDIF
RETURN .T.
ENDFUNC