home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / SBTAR2.ZIP / SYSFLAG.PRG < prev    next >
Encoding:
Text File  |  1990-06-04  |  19.9 KB  |  655 lines

  1. ********************** ' MultiNet Source Code ' ***********************
  2. ** '                       SBT Corporation                         ' **
  3. ** '         One Harbor Drive, Sausalito, California 94965         ' **
  4. ** '                   Telephone (415) 331-9900                    ' **
  5. ***********************************************************************
  6. ** '   (c) Copyright 1984, Revisions 1985 - 1990 SBT Corporation   ' **
  7. ** '            All Rights Reserved by SBT Corporation             ' **
  8. ** '                                                               ' **
  9. ***********************************************************************
  10. ** ' 06/04/90 = Last Update  **  SYSFLAG.PRG  **   Version 6.35.00 ' **
  11. ***********************************************************************
  12. *
  13. * '  Module:                         Versions
  14. * '  -----------------------------   ----------------
  15. * '  Accounts Payable MultiNet       5.30, 6.10, 6.20, 6.21, 6.30
  16. * '  Accounts Receivable MultiNet    5.30, 6.10, 6.20, 6.30
  17. * '  Fixed Assets MultiNet           6.20
  18. * '  Time Billing MultiNet           6.10, 6.20
  19. * '  General Ledger MultiNet         6.10, 6.15, 6.20, 6.30
  20. * '  Manufacturing MultiNet          6.10, 6.15
  21. * '  Maintenance MultiNet            6.10
  22. * '  Job Cost MultiNet               6.10, 6.20
  23. * '  Purchase Orders MultiNet        5.30, 6.10, 6.20, 6.30
  24. * '  Sales Orders MultiNet           5.30, 6.10, 6.20, 6.30
  25. * '  Payroll MultiNet                6.15, 6.30
  26. * '  Property MultiNet               6.20
  27. *
  28. * ' Clears all multi-user flags in SYSDATA file and signature fields
  29. * ' in master files (where 99 = under maintenance), and deletes any
  30. * ' temporary files (0*.DBF and 0*.NDX) on current and data directory.
  31. *
  32. SET TALK OFF
  33. RELEASE clipper,xquicks,fox,mcmax
  34. PUBLIC clipper,xquicks,fox,mcmax
  35. SET BELL OFF
  36. SET SAFETY OFF
  37. SET ESCAPE OFF
  38. SET EXCLUSIVE OFF
  39. SET DELIMITER OFF
  40. SET DEVICE TO SCREEN
  41. SET PRINT OFF
  42. SET CONSOLE ON
  43. CLOSE DATABASES
  44. IF ISCOLOR()
  45.   SET COLOR TO W+/B,N/W,B
  46.   STORE 'C' TO m0monitor
  47. ELSE
  48.   SET COLOR TO W+/N,N/W,N
  49.   STORE 'M' TO m0monitor
  50. ENDIF
  51. CLEAR
  52. STORE '' TO mtempdr
  53. STORE ' ' TO mans
  54. IF .NOT. FILE('sysdata.dbf')
  55.   ?? CHR(7)
  56.   @ 2,4 SAY 'Warning [9002] - SYSDATA.DBF Missing.'
  57.   @ 4,4 SAY 'Informational only - No data has been lost.'
  58.   @ 6,4 SAY 'The SYSDATA.DBF System Data File is not in the current drive and'
  59.   @ 7,4 SAY 'directory.  Make sure this file is present and try again'
  60.   @ 10,4 SAY 'SYSFLAG Cancelled.  Press any key to continue...' GET mans
  61.   READ
  62.   SET TALK ON
  63.   SET SAFETY ON
  64.   RETURN
  65. ENDIF
  66. STORE 'SYSFLAG for MultiNet' TO mtitle
  67. STORE '   SBT' TO msyflv
  68. USE sysdata
  69. LOCATE FOR UPPER(sysid) = 'MM  '
  70. IF EOF()
  71.   ?? CHR(7)
  72.   @ 2,4 SAY 'Warning [9001] - SYSDATA Files/Record Missing.'
  73.   @ 4,4 SAY 'Informational only - No data has been lost.'
  74.   @ 6,4 SAY 'The SYSDATA.DBF is not properly installed.  Please run one of'
  75.   @ 7,4 SAY 'the SBT Installation programs and try again.'
  76.   @ 9,4 SAY 'SYSFLAG Cancelled.  Press any key to continue...' GET mans
  77.   READ
  78.   SET TALK ON
  79.   SET SAFETY ON
  80.   RETURN
  81. ENDIF
  82. STORE SUBSTR(link,2,1) TO mos
  83. STORE str2 + SUBSTR(str3,1,35) TO m0border
  84. STORE DATE() TO m0date
  85. IF CTOD(SUBSTR(a->str8,1,8)) > m0date
  86.   STORE CTOD(SUBSTR(a->str8,1,8)) TO m0date
  87. ENDIF
  88. IF SUBSTR(link,2,1) <> 'D'
  89.   STORE SUBSTR(link,1,1) TO m0switchar
  90. ELSE
  91.   STORE '\' TO m0switchar
  92.   STORE TRIM(LTRIM(SUBSTR(str5,2,25))) TO m0color
  93.   IF SUBSTR(str5,1,1) $ 'CM'
  94.     SET COLOR TO &m0color
  95.     STORE SUBSTR(str5,1,1) TO m0monitor
  96.   ELSE
  97.     * ' If monitor type not defined
  98.     SET COLOR TO W+/N,N/W,N
  99.     @ 22,10 SAY 'What type of Monitor do you have ? (Color/Mono) ' + ;
  100.     SUBSTR(m0border,181,5) GET m0monitor PICTURE '!'
  101.     READ SAVE
  102.     DO WHILE .NOT. m0monitor $ 'CM'
  103.       ?? CHR(7)
  104.       READ SAVE
  105.     ENDDO
  106.     CLEAR GETS
  107.     DO CASE
  108.       CASE m0monitor = 'C' .AND. LEN(m0color) > 0
  109.         SET COLOR TO &m0color
  110.       CASE m0monitor = 'C'
  111.         SET COLOR TO W+/B,N/W,B
  112.       OTHERWISE
  113.         SET COLOR TO W+/N,N/W,N
  114.     ENDCASE
  115.   ENDIF && SUBSTR(str5,1,1) $ 'CM'
  116. ENDIF && SUBSTR(link,2,1) <> 'D'
  117. USE
  118. CLEAR
  119. @ 1,1 SAY DTOC(m0date)
  120. @ 1,40 - INT(LEN(mtitle)/2) SAY mtitle
  121. @ 1,73 SAY msyflv
  122. @ 2,1 SAY SUBSTR(m0border,10,78)
  123. STORE ' *****  DANGER! - READ WARNING BELOW BEFORE CONTINUING  ***** ' TO msg
  124. @ 4,4 GET msg
  125. CLEAR GETS
  126. @ 6,4 SAY 'This program clears the flags from the SYSDATA.DBF file which'
  127. @ 7,4 SAY 'keep track of how many people are currently using the system'
  128. @ 8,4 SAY 'and whether system maintenance is being performed. '
  129. @ 10,4 SAY 'Maintenance flags can also be cleared from other files in'
  130. @ 11,4 SAY 'your system which are identified in SYSDATA.DBF and contain'
  131. @ 12,4 SAY 'the SIGNATURE field.'
  132. @ 14,4 SAY "Physically check other users' workstations to be sure that"
  133. @ 15,4 SAY 'you are the only person who is logged in.'
  134. @ 17,4 SAY 'Failure to do this may jeopardize the integrity of your data.'
  135. @ 19,4 SAY '*** DO NOT RUN THIS PROGRAM IF OTHER USERS ARE LOGGED IN ***'
  136. STORE ' ' TO mans
  137. SET CONFIRM ON
  138. ?? CHR(7)
  139. @ 22,4 SAY "Enter 'Y' and <Enter> to continue or " + ;
  140. "any other key to abort " + SUBSTR(m0border,182,5) GET mans PICTURE '!'
  141. READ
  142. SET CONFIRM OFF
  143. IF mans <> 'Y'
  144.   @ 22,0
  145.   @ 22,4 SAY '*****  SYSFLAG Cancelled  *****'
  146.   SET TALK ON
  147.   SET SAFETY ON
  148.   SET ESCAPE ON
  149.   RETURN
  150. ENDIF
  151. IF .NOT. (clipper .OR. xquicks .OR. fox .OR. mcmax)
  152.   CLEAR
  153.   @ 1,1 SAY DTOC(m0date)
  154.   @ 1,40 - INT(LEN(mtitle)/2) SAY mtitle
  155.   @ 1,73 SAY msyflv
  156.   @ 2,1 SAY SUBSTR(m0border,10,78)
  157.   @ 4,4 SAY ' *****  DANGER! - CHECK LISTING OF USERS BELOW BEFORE ' + ;
  158.   'CONTINUING  ***** '
  159.   @ 5,4 SAY ' '
  160.   DISPLAY USERS
  161.   STORE ' ' TO mans
  162.   SET CONFIRM ON
  163.   @ 22,4 SAY "Enter 'Y' and <Enter> to continue or " + ;
  164.   "any other key to abort " + SUBSTR(m0border,182,5) GET mans PICTURE '!'
  165.   READ
  166.   SET CONFIRM OFF
  167.   IF mans <> 'Y'
  168.     @ 22,0
  169.     @ 22,4 SAY '*****  SYSFLAG Cancelled  *****'
  170.     SET TALK ON
  171.     SET SAFETY ON
  172.     SET ESCAPE ON
  173.     RETURN
  174.   ENDIF
  175. ENDIF && clipper .OR. xquicks .OR. fox .OR. mcmax
  176. CLEAR
  177. @ 1,1 SAY DTOC(m0date)
  178. @ 1,40 - INT(LEN(mtitle)/2) SAY mtitle
  179. @ 1,73 SAY msyflv
  180. @ 2,1 SAY SUBSTR(m0border,10,78)
  181. STORE 6 TO mline
  182. *
  183. * ' Customization Note:  If you set mlimit to 'Y' and define mcomp to equal
  184. * ' a specific company number, you can create a custom SYSFLAG program which
  185. * ' will just clear flags from files within that company.  This can be useful
  186. * ' for circumstances when flags other than system wide flags are left on, and
  187. * ' you wish to clear them without requiring all users be off the system.
  188. *
  189. * ' If you use this feature, the program will not clear system wide user count
  190. * ' flags.
  191. *
  192. STORE 'N' TO mlimit
  193. USE sysdata
  194. @ 22,0
  195. @ 22,4 SAY '*****  Checking SYSDATA file for Installed Modules  *****'
  196. STORE '' TO mfiles
  197. STORE 'N' TO mq530, mqap, mqar, mqas, mqdb, mqgl, mqjc, mqma, mqmn, ;
  198. mqpo, mqpr, mqso, mqpm
  199. STORE 'Y' TO mqsys
  200. IF mlimit = 'N'
  201.   * ' check for installed 5.30 modules
  202.   LOCATE FOR SUBSTR(sysid,1,2) $ 'AP.PO.SO' .AND. SUBSTR(sysid,3,2) = SPACE(2)
  203.   IF .NOT. EOF()
  204.     STORE 'Y' TO mq530
  205.   ENDIF
  206. ENDIF
  207. * ' check for installed 6.10/6.15/6.20/6.21/6.30 modules
  208. LOCATE FOR SUBSTR(sysid,1,2) = 'AP' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  209. .AND. SUBSTR(pass2,1,1) <> 'D'
  210. IF .NOT. EOF()
  211.   STORE 'Y' TO mqap
  212. ENDIF
  213. LOCATE FOR SUBSTR(sysid,1,2) = 'AR' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  214. .AND. SUBSTR(pass2,1,1) <> 'D'
  215. IF .NOT. EOF()
  216.   STORE 'Y' TO mqar
  217. ENDIF
  218. LOCATE FOR SUBSTR(sysid,1,2) = 'AS' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  219. .AND. SUBSTR(pass2,1,1) <> 'D'
  220. IF .NOT. EOF()
  221.   STORE 'Y' TO mqas
  222. ENDIF
  223. LOCATE FOR SUBSTR(sysid,1,2) = 'DB' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  224. .AND. SUBSTR(pass2,1,1) <> 'D'
  225. IF .NOT. EOF()
  226.   STORE 'Y' TO mqdb
  227. ENDIF
  228. LOCATE FOR SUBSTR(sysid,1,2) = 'GL' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  229. .AND. SUBSTR(pass2,1,1) <> 'D'
  230. IF .NOT. EOF()
  231.   STORE 'Y' TO mqgl
  232. ENDIF
  233. LOCATE FOR SUBSTR(sysid,1,2) = 'JC' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  234. .AND. SUBSTR(pass2,1,1) <> 'D'
  235. IF .NOT. EOF()
  236.   STORE 'Y' TO mqjc
  237. ENDIF
  238. LOCATE FOR SUBSTR(sysid,1,2) = 'MA' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  239. .AND. SUBSTR(pass2,1,1) <> 'D'
  240. IF .NOT. EOF()
  241.   STORE 'Y' TO mqma
  242. ENDIF
  243. LOCATE FOR SUBSTR(sysid,1,2) = 'MN' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  244. .AND. SUBSTR(pass2,1,1) <> 'D'
  245. IF .NOT. EOF()
  246.   STORE 'Y' TO mqmn
  247. ENDIF
  248. LOCATE FOR SUBSTR(sysid,1,2) = 'PO' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  249. .AND. SUBSTR(pass2,1,1) <> 'D'
  250. IF .NOT. EOF()
  251.   STORE 'Y' TO mqpo
  252. ENDIF
  253. LOCATE FOR SUBSTR(sysid,1,2) = 'PR' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  254. .AND. SUBSTR(pass2,1,1) <> 'D'
  255. IF .NOT. EOF()
  256.   STORE 'Y' TO mqpr
  257. ENDIF
  258. LOCATE FOR SUBSTR(sysid,1,2) = 'SO' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  259. .AND. SUBSTR(pass2,1,1) <> 'D'
  260. IF .NOT. EOF()
  261.   STORE 'Y' TO mqso
  262. ENDIF
  263. LOCATE FOR SUBSTR(sysid,1,2) = 'PM' .AND. SUBSTR(sysid,3,2) <> SPACE(2) ;
  264. .AND. SUBSTR(pass2,1,1) <> 'D'
  265. IF .NOT. EOF()
  266.   STORE 'Y' TO mqpm
  267. ENDIF
  268. USE
  269. * ' display selection screen and ask for modules to clear
  270. CLEAR
  271. @ 1,1 SAY DTOC(m0date)
  272. @ 1,40 - INT(LEN(mtitle)/2) SAY mtitle
  273. @ 1,73 SAY msyflv
  274. @ 2,1 SAY SUBSTR(m0border,10,78)
  275. @ 4,12 SAY 'Select Files to clear flags from:'
  276. STORE 6 TO mline
  277. * ' ask for SYSDATA.DBF
  278. STORE 'Y' TO mans
  279. @ mline,12 SAY 'System Master file - SYSDATA.DBF ?'
  280. @ mline,53 SAY '(Y/N)  '+ SUBSTR(m0border,180,7) GET mqsys PICTURE 'Y'
  281. STORE mline + 1 TO mline
  282. IF mq530 = 'Y'
  283.   STORE 'N' TO mq530
  284.   * ' Ask for 5.30 if present
  285.   @ mline,12 SAY 'AP/PO/SO Version 5.30 Files ?'
  286.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqap PICTURE 'Y'
  287.   STORE mline + 1 TO mline
  288. ENDIF
  289. IF mqap = 'Y'
  290.   STORE 'N' TO mqap
  291.   @ mline,12 SAY 'Accounts Payable Series Six Files ?'
  292.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqap PICTURE 'Y'
  293.   STORE mline + 1 TO mline
  294. ENDIF
  295. IF mqar = 'Y'
  296.   STORE 'N' TO mqar
  297.   @ mline,12 SAY 'Accounts Receivable Series Six Files ?'
  298.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqar PICTURE 'Y'
  299.   STORE mline + 1 TO mline
  300. ENDIF
  301. IF mqas = 'Y'
  302.   STORE 'N' TO mqas
  303.   @ mline,12 SAY 'Fixed Assets Series Six Files ?'
  304.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqas PICTURE 'Y'
  305.   STORE mline + 1 TO mline
  306. ENDIF
  307. IF mqdb = 'Y'
  308.   STORE 'N' TO mqdb
  309.   @ mline,12 SAY 'Time Billing Series Six Files ?'
  310.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqdb PICTURE 'Y'
  311.   STORE mline + 1 TO mline
  312. ENDIF
  313. IF mqgl = 'Y'
  314.   STORE 'N' TO mqgl
  315.   @ mline,12 SAY 'General Ledger Series Six Files ?'
  316.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqgl PICTURE 'Y'
  317.   STORE mline + 1 TO mline
  318. ENDIF
  319. IF mqjc = 'Y'
  320.   STORE 'N' TO mqjc
  321.   @ mline,12 SAY 'Job Cost Series Six Files ?'
  322.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqjc PICTURE 'Y'
  323.   STORE mline + 1 TO mline
  324. ENDIF
  325. IF mqma = 'Y'
  326.   STORE 'N' TO mqma
  327.   @ mline,12 SAY 'Manufacturing Series Six Files ?'
  328.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqma PICTURE 'Y'
  329.   STORE mline + 1 TO mline
  330. ENDIF
  331. IF mqmn = 'Y'
  332.   STORE 'N' TO mqmn
  333.   @ mline,12 SAY 'Maintenance Series Six Files ?'
  334.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqmn PICTURE 'Y'
  335.   STORE mline + 1 TO mline
  336. ENDIF
  337. IF mqpo = 'Y'
  338.   STORE 'N' TO mqpo
  339.   @ mline,12 SAY 'Purchase Orders Series Six Files ?'
  340.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqpo PICTURE 'Y'
  341.   STORE mline + 1 TO mline
  342. ENDIF
  343. IF mqpr = 'Y'
  344.   STORE 'N' TO mqpr
  345.   @ mline,12 SAY 'Payroll Series Six Files ?'
  346.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqpr PICTURE 'Y'
  347.   STORE mline + 1 TO mline
  348. ENDIF
  349. IF mqso = 'Y'
  350.   STORE 'N' TO mqso
  351.   @ mline,12 SAY 'Sales Orders Series Six Files ?'
  352.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqso PICTURE 'Y'
  353.   STORE mline + 1 TO mline
  354. ENDIF
  355. IF mqpm = 'Y'
  356.   STORE 'N' TO mqpm
  357.   @ mline,12 SAY 'Property Series Six Files ?'
  358.   @ mline,60 SAY SUBSTR(m0border,180,7) GET mqpm PICTURE 'Y'
  359.   STORE mline + 1 TO mline
  360. ENDIF
  361. READ
  362. CLEAR GETS
  363. * ' setup file name string with files to process
  364. IF mqap = 'Y'
  365.   STORE mfiles + 'APMAST.' TO mfiles
  366. ENDIF
  367. IF mqar = 'Y'
  368.   STORE mfiles + 'ARMAST.' TO mfiles
  369. ENDIF
  370. IF mqas = 'Y'
  371.   STORE mfiles + 'ASSETS.' TO mfiles
  372. ENDIF
  373. IF mqdb = 'Y'
  374.   STORE mfiles + 'DBTRAN.' TO mfiles
  375. ENDIF
  376. IF mqgl = 'Y'
  377.   STORE mfiles + 'GLACNT.' TO mfiles
  378. ENDIF
  379. IF mqjc = 'Y'
  380.   STORE mfiles + 'JCMSTR.JCPROJ.' TO mfiles
  381. ENDIF
  382. IF mqma = 'Y'
  383.   STORE mfiles + 'MABILL.MATRAN.' TO mfiles
  384. ENDIF
  385. IF mqmn = 'Y'
  386.   STORE mfiles + 'MNCONF.MNEQUI.MNMAIN.' TO mfiles
  387. ENDIF
  388. IF mqpo = 'Y'
  389.   STORE mfiles + 'POMAST.' TO mfiles
  390. ENDIF
  391. IF mqpr = 'Y'
  392.   STORE mfiles + 'PREMPL.PRDEDU.PRPOST.PRXPST.PRMAST.PRTXCD.' TO mfiles
  393. ENDIF
  394. IF mqso = 'Y'
  395.   STORE mfiles + 'SOMAST.' TO mfiles
  396. ENDIF
  397. IF mqpm = 'Y'
  398.   STORE mfiles + 'PMTRAN.' TO mfiles
  399. ENDIF
  400. * ' qive final chance to cancel
  401. STORE mline + 1 TO mline
  402. STORE 'Y' TO mans
  403. @ mline,12 SAY 'Continue with clearing of flags ? (Y/N) ' + ;
  404. SUBSTR(m0border,182,5) GET mans PICTURE 'Y'
  405. READ
  406. IF mans = 'N'
  407.   USE
  408.   @ 22,0
  409.   @ 22,12 SAY '*****  SYSFLAG Cancelled  *****'
  410.   SET TALK ON
  411.   SET SAFETY ON
  412.   SET ESCAPE ON
  413.   RETURN
  414. ENDIF
  415. @ 3,0 CLEAR
  416. IF mqsys = 'Y'
  417.   * ' clear flags in system file if selected
  418.   USE sysdata
  419.   STORE FLOCK() TO lockedf
  420.   STORE ' ' TO mwait
  421.   DO WHILE .NOT. lockedf .AND. .NOT. mwait $ 'Nn'
  422.     STORE ' ' TO mwait
  423.     ?? CHR(7)
  424.     ?
  425.     WAIT 'File is in use. Press N to quit or any key to retry... ' TO mwait
  426.     STORE FLOCK() TO lockedf
  427.   ENDDO
  428.   IF .NOT. lockedf
  429.     USE
  430.     @ 22,0
  431.     @ 22,12 SAY '*****  SYSFLAG Cancelled  *****'
  432.     SET TALK ON
  433.     SET SAFETY ON
  434.     SET ESCAPE ON
  435.     RETURN
  436.   ENDIF
  437.   LOCATE FOR sysid = 'MM  '
  438.   @ 23,0
  439.   @ 23,3 SAY 'Clearing maintenance flags from SYSDATA.DBF...'
  440.   IF mlimit = 'Y'
  441.     SET FILTER TO SUBSTR(sysid,3,2) = mcomp
  442.     GO TOP
  443.   ELSE
  444.     REPLACE ALL str10 WITH 'NNNNNNNNNN'+SUBSTR(str10,9,2), int2 WITH 0, ;
  445.     int3 WITH 1, num8 WITH 0, num10 WITH 0 FOR UPPER(sysid) = 'MM  '
  446.   ENDIF
  447.   REPLACE ALL str10 WITH 'NNNNNNNNNN', num10 WITH 0 FOR ;
  448.   SUBSTR(UPPER(sysid),1,2) $ 'AP|AS|DB|JC|PM' .AND. SUBSTR(sysid,3,2) <> '  '
  449.   REPLACE ALL str10 WITH 'NNNNNNNNNN', num8 WITH 0 FOR ;
  450.   SUBSTR(UPPER(sysid),1,2) = 'MA'
  451.   REPLACE ALL num10 WITH 0, num9 WITH 0, num8 WITH 0, str1 WITH 'N' + ;
  452.   SPACE(149) FOR SUBSTR(UPPER(sysid),1,2) = 'GL' .AND. ;
  453.   SUBSTR(sysid,3,2) <> '  '
  454.   REPLACE ALL int2 WITH 0, int3 WITH 0 FOR SUBSTR(UPPER(sysid),1,2) $ ;
  455.   'PR.JC' .AND. SUBSTR(sysid,3,2) <> '  ' .AND. VAL(SUBSTR(drive,198,3)) ;
  456.   >= 615
  457.   USE
  458. ENDIF && mqsys = 'Y'
  459. IF mq530 = 'Y'
  460.   * ' clear version 5.30 master file flags if selected
  461.   STORE 1 TO mcnt
  462.   DO WHILE .t.
  463.     DO CASE
  464.       CASE mcnt = 1
  465.         STORE 'AP' TO mpgmid
  466.       CASE mcnt = 2
  467.         STORE 'PO' TO mpgmid
  468.       CASE mcnt = 3
  469.         STORE 'SO' TO mpgmid
  470.       OTHERWISE
  471.         EXIT
  472.     ENDCASE
  473.     USE sysdata
  474.     LOCATE FOR sysid = mpgmid + '  '
  475.     IF .NOT. EOF()
  476.       STORE TRIM(SUBSTR(drive,61,30)) TO mdrive
  477.       STORE mdrive + mpgmid + '-MAST' TO mfilef
  478.       IF FILE('&mfilef..dbf')
  479.         ?
  480.         ? 'Clearing maintenance flags from ' + mfilef + '.DBF...'
  481.         SELECT b
  482.         USE &mfilef
  483.         STORE FLOCK() TO lockedf
  484.         STORE ' ' TO mwait
  485.         DO WHILE .NOT. lockedf .AND. .NOT. mwait $ 'Nn'
  486.           STORE ' ' TO mwait
  487.           ?? CHR(7)
  488.           ?
  489.           WAIT 'File is in use. Press N to quit or any key to retry... ' ;
  490.           TO mwait
  491.           STORE FLOCK() TO lockedf
  492.         ENDDO
  493.         IF lockedf
  494.           REPLACE ALL signature WITH 0
  495.         ENDIF
  496.         USE
  497.         SELECT a
  498.       ENDIF && FILE('&mfilef..dbf')
  499.     ENDIF && .NOT. EOF()
  500.     STORE mcnt + 1 TO mcnt
  501.   ENDDO && WHILE .t.
  502. ENDIF && mq530 = 'Y'
  503. IF 'Y' $ mqap + mqar + mqas + mqdb + mqgl + mqjc + mqma + mqmn + mqpo + ;
  504.   mqpr + mqso + mqpm
  505.   * ' clear version 6.xx file flags, if any selected
  506.   STORE 1 TO mcnt
  507.   DO WHILE .t.
  508.     DO CASE
  509.       CASE mcnt = 1
  510.         STORE 'APMAST' TO mfilef
  511.       CASE mcnt = 2
  512.         STORE 'ARMAST' TO mfilef
  513.       CASE mcnt = 3
  514.         STORE 'ASSETS' TO mfilef
  515.       CASE mcnt = 4
  516.         STORE 'DBTRAN' TO mfilef
  517.       CASE mcnt = 5
  518.         STORE 'GLACNT' TO mfilef
  519.       CASE mcnt = 6
  520.         STORE 'JCMSTR' TO mfilef
  521.       CASE mcnt = 7
  522.         STORE 'JCPROJ' TO mfilef
  523.       CASE mcnt = 8
  524.         STORE 'MABILL' TO mfilef
  525.       CASE mcnt = 9
  526.         STORE 'MATRAN' TO mfilef
  527.       CASE mcnt = 10
  528.         STORE 'MNCONF' TO mfilef
  529.       CASE mcnt = 11
  530.         STORE 'MNEQUI' TO mfilef
  531.       CASE mcnt = 12
  532.         STORE 'MNMAIN' TO mfilef
  533.       CASE mcnt = 13
  534.         STORE 'POMAST' TO mfilef
  535.       CASE mcnt = 14
  536.         STORE 'PREMPL' TO mfilef
  537.       CASE mcnt = 15
  538.         STORE 'PRDEDU' TO mfilef
  539.       CASE mcnt = 16
  540.         STORE 'PRPOST' TO mfilef
  541.       CASE mcnt = 17
  542.         STORE 'PRHPST' TO mfilef
  543.       CASE mcnt = 18
  544.         STORE 'PRXPST' TO mfilef
  545.       CASE mcnt = 19
  546.         STORE 'PRMAST' TO mfilef
  547.       CASE mcnt = 20
  548.         STORE 'PRTXCD' TO mfilef
  549.       CASE mcnt = 21
  550.         STORE 'SOMAST' TO mfilef
  551.       CASE mcnt = 22
  552.         STORE 'PMTRAN' TO mfilef
  553.       OTHERWISE
  554.         EXIT
  555.     ENDCASE
  556.     IF mfilef + '.' $ mfiles
  557.       SELECT a
  558.       USE sysdata
  559.       * ' find module SYSDATA records
  560.       LOCATE FOR SUBSTR(sysid,1,2) = SUBSTR(mfilef,1,2) .AND. ;
  561.       SUBSTR(sysid,3,4) <> '  ' .AND. SUBSTR(pass2,1,1) <> 'D'
  562.       DO WHILE .NOT. EOF()
  563.         * ' get data drive/directory
  564.         STORE TRIM(SUBSTR(drive,61,30)) + mfilef + SUBSTR(sysid,3,2) ;
  565.         TO mxfilef
  566.         STORE TRIM(SUBSTR(drive,61,30)) TO tempdr
  567.         IF FILE('&mxfilef..dbf')
  568.           * ' if file found, clear flags
  569.           @ 23,0
  570.           @ 23,3 SAY 'Clearing maintenance flags from ' + mxfilef + '.DBF...'
  571.           SELECT b
  572.           USE &mxfilef
  573.           * ' lock file
  574.           STORE FLOCK() TO lockedf
  575.           STORE ' ' TO mwait
  576.           DO WHILE .NOT. lockedf .AND. .NOT. mwait $ 'Nn'
  577.             STORE ' ' TO mwait
  578.             ?? CHR(7)
  579.             ?
  580.             WAIT 'File is in use. Press N to quit or any key to retry... ' ;
  581.             TO mwait
  582.             STORE FLOCK() TO lockedf
  583.           ENDDO
  584.           * ' check to make sure there is a SIGNATURE field before clearing
  585.           RELEASE signature
  586.           IF lockedf .AND. TYPE('signature') = 'N'
  587.             REPLACE ALL signature WITH 0
  588.           ENDIF
  589.           USE
  590.           SELECT a
  591.         ENDIF && FILE('&mxfilef..dbf')
  592.         * ' if DOS or Xenix, delete temporary files in data directory
  593.         IF mtempdr <> tempdr .AND. mos $ 'DX'
  594.           @ 23,0
  595.           @ 23,3 SAY 'Deleting (0*.DBF/NDX) files from Data Directory: ' + ;
  596.           tempdr
  597.           SET CONSOLE OFF
  598.           IF mos = 'D'
  599.             STORE 'IF EXIST ' + tempdr + '0*.DBF DEL ' + tempdr + ;
  600.             '0*.DBF > NUL' TO mdosact
  601.           ELSE
  602.             STORE 'rm -f ' + tempdr + '0*.DBF' TO mdosact
  603.           ENDIF
  604.           RUN &mdosact.
  605.           IF mos = 'D'
  606.             STORE 'IF EXIST ' + tempdr + '0*.NDX DEL ' + tempdr + ;
  607.             '0*.NDX > NUL' TO mdosact
  608.           ELSE
  609.             STORE 'rm -f ' + tempdr + '0*.NDX' TO mdosact
  610.           ENDIF
  611.           RUN &mdosact.
  612.           SET CONSOLE ON
  613.         ENDIF
  614.         STORE tempdr TO mtempdr
  615.         CONTINUE
  616.       ENDDO && WHILE .NOT. EOF()
  617.       USE
  618.     ENDIF && mfilef + '.' $ mfiles
  619.     STORE mcnt + 1 TO mcnt
  620.   ENDDO && WHILE .t.
  621. ENDIF && 'Y' $ mqap + mqar + mqas + mqdb + mqgl + mqjc + mqma + mqmn etc.
  622. CLOSE DATABASES
  623. IF mos $ 'DX'
  624.   * ' if DOS or Xenix, delete any temporary files
  625.   @ 23,0
  626.   @ 23,3 SAY ;
  627.   'Deleting temporary (0*.DBF and 0*.NDX) files in current directory...'
  628.   SET CONSOLE OFF
  629.   IF mos = 'D'
  630.     RUN IF EXIST 0*.DBF DEL 0*.DBF
  631.   ELSE
  632.     RUN rm -f 0*.dbf
  633.   ENDIF
  634.   IF mos = 'D'
  635.     RUN IF EXIST 0*.NDX DEL 0*.NDX
  636.   ELSE
  637.     RUN rm -f 0*.ndx
  638.   ENDIF
  639.   SET CONSOLE ON
  640. ENDIF
  641. @ 22,0 CLEAR
  642. @ 22,3 SAY 'Clearing of Flags Completed...'
  643. @ 23,3 SAY '*****  SYSFLAG Program Normal End  *****'
  644. SET TALK ON
  645. SET SAFETY ON
  646. SET ESCAPE ON
  647. RETURN
  648. *
  649. * ' $Revision:   1.17  $
  650. * ' $Date:   29 May 1990 17:34:42  $
  651. **********************
  652. ** ' SYSFLAG.PRG  ' **
  653. ** ' 654 Lines    ' **
  654. **********************
  655.