home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / chrchpr4.zip / MGSAROST.CMD < prev    next >
OS/2 REXX Batch file  |  1987-01-06  |  5KB  |  184 lines

  1. * Program MGSAROST - Generates MACTIVTY file of people's special activities
  2. *  OUTPUT:  [MACTIVTY index MACTIVTY]
  3. Erase
  4. Set intensity off
  5. Set talk off
  6. @ 2,10 say 'Activities file generation process'
  7. ? 'This program prints out data errors when found, so ready the printer.'
  8. @ 5,0 say  'Now scanning the MDIRFILE for Special Activities names.'
  9. Select primary
  10. USE MDIRFILE index MDIRFILE
  11. Store 'SPAC=' to spac
  12. Find &SPAC
  13. If # = 0
  14.   Accept 'No Special Activities in MDIRFILE. Press <retn> to terminate.' to XX
  15. else
  16. Select secondary
  17. USE mdirfilx
  18. Copy to SPACFILE STRUCTURE
  19. Use SPACFILE
  20. Select primary
  21. Store 1 to actcount
  22. Store ' ' to actlist
  23. Store chr(31) to chr31
  24. Do while $(spact,1,4) = 'SPAC'
  25.   Select secondary
  26.   Append blank
  27.   replace SPACT with $(P.SPACT,6,4)
  28.   If actcount<64
  29.     Store actlist+$(spact,1,4) to actlist
  30.     Store actcount+1 to actcount
  31.   else
  32.     ? 'Special Activities found are:  ',actlist
  33.     Store ' '+$(spact,1,4) to actlist
  34.   endif
  35.   Select primary
  36.   SKIP
  37. enddo
  38. Select secondary
  39. USE SPACFILE
  40. Index on SPACT to SPACFILE
  41. USE SPACFILE index SPACFILE
  42. ? 'Special Activities found are: ',actlist
  43. ? 'Now copying MEMBERS that have Special Activities to MACTIVTY file.'
  44. Select primary
  45. Store d+':members' to MFILE
  46. USE &MFILE
  47. Store d+':MACTIVTY' to M1FILE
  48. Set talk on
  49. COPY to &M1FILE for $(SP:ACTiVTY,1,3) <> '   ' .and. $(membstatus,2,1) <> '*'
  50. Set talk off
  51. USE &M1FILE
  52. APPEND blank
  53. Store # to lastrec
  54. Delete
  55. GOTO top
  56. Store 1 to reccount
  57. ? 'Now expanding MACTIVTY file for multi-activity people.'
  58. Set format to print
  59. @ 1,20 say 'Activities code errors in MEMBERS file - '+curdate
  60. Store 3 to curline
  61. Store 0 to recnumB
  62. Store 0 to recc
  63. Do while # < lastrec
  64.     Store sp:activty to sp:act
  65.     Store # to currec
  66.     Store 1 to fieldcnt
  67.     Do while fieldcnt < 21
  68.       Store $(sp:act,fieldcnt,3) to spactiv
  69.       If spactiv='   '
  70.         Store 21 to fieldcnt
  71.       else
  72.         Select secondary
  73.         Find &spactiv
  74.         If # = 0
  75.          Select primary
  76.          Store $(sp:act,fieldcnt,21-fieldcnt) to badspact
  77.          If fieldcnt=1
  78.            Delete
  79.          endif
  80.          Store 22 to fieldcnt
  81.        else
  82.          Select primary
  83.          STORE $(SP:ACT,FIELDCNT,3)+'.' TO SPACTIV
  84.          IF $(SP:ACT,FIELDCNT+3,1)='"'
  85.            STORE $(SPActiv,1,3)+chr31 TO SPACTIV
  86.          ENDIF
  87.          If fieldcnt>1
  88.          Store last:name to xlast
  89.          Store first:name to xfirst
  90.          Store membstatus to xmemb
  91.          Store home:phone to xhph
  92.          Store work:phone to xwph
  93.          Store address to xaddr
  94.          Store city:state to xcityst
  95.          Store zip to xzip
  96.          Store birthdate to xbirth
  97.          Store ss:sc:memb to xsssc
  98.          Store skills to xskills
  99.          Store other to xother
  100.          Store dates to xdates
  101.          Append blank
  102.          Replace last:name with xlast
  103.          Replace first:name with xfirst
  104.          Replace membstatus with xmemb
  105.          Replace home:phone with xhph
  106.          Replace work:phone with xwph
  107.          Replace address with xaddr
  108.          Replace city:state with xcityst
  109.          Replace zip with xzip
  110.          Replace birthdate with xbirth
  111.          Replace ss:sc:memb with xsssc
  112.          Replace skills with xskills
  113.          Replace other with xother
  114.          Replace sp:activty with spactiv
  115.          Replace dates with xdates
  116.          GOTO currec
  117.          ELSE
  118.            REPLACE SP:ACTIVTY WITH SPACTIV
  119.          endif
  120.         Store fieldcnt+4 to fieldcnt
  121.         endif
  122.       endif
  123.     enddo
  124.   If fieldcnt = 22
  125.     @ curline,1 say ss:sc:memb+last:name+first:name+home:phone+address+badspact
  126.     If *
  127.       REPLACE SP:ACTIVTY with '~~~'
  128.     endif
  129.     Store curline+1 to curline
  130.     If curline > 63
  131.       EJECT
  132.       Store 1 to curline
  133.     endif
  134.   endif
  135.   SKIP
  136.   Store recc+1 to recc
  137.   If recc = 20
  138.     Store 0 to recc
  139.     Store recnumb+20 to recnumb
  140.     Set format to screen
  141.     ? recnumb,' records processed.'
  142.     Set format to print
  143.   endif
  144. enddo
  145. EJECT
  146. Set format to screen
  147. USE &M1FILE
  148. ? 'Expansion is complete. Now indexing MACTIVTY file by SP:ACTIVTY name.'
  149. Set talk on
  150. Index on sp:activty+last:name+first:name to &M1FILE
  151. Set talk off
  152. USE
  153. ? 'MACTIVTY file is complete.'
  154. Release spac,actcount,actlist,reccount,xlast,xfirst,xmemb,xhph,xwph,xaddr,xzip
  155. Release xcityst,xbirth,xsssc,spactiv,xskills,xother,xdates,curline,chr31
  156. Release M1FILE,LASTREC,RECNUMB,RECC,CURREC,FIELDCNT,BADSPACT,SP:ACTIVTY
  157. Set console off
  158. Delete file('spacfile.dbf')
  159. Delete file('spacfile.ndx')
  160. Set console on
  161. endif
  162. RETURN
  163. SE mdirfilx
  164. Copy to SPACFILE STRUCTURE
  165. Use SPACFILE
  166. Select primary
  167. Store 1 to actcount
  168. Store ' ' to actlist
  169. Store chr(31) to chr31
  170. Do while $(spact,1,4) = 'SPAC'
  171.   Select secondary
  172.   Append blank
  173.   replace SPACT with $(P.SPACT,6,4)
  174.   If actcount<64
  175.     Store actlist+$(spact,1,4) to actlist
  176.     Store actcount+1 to actcount
  177.   else
  178.     ? 'Special Activities found are:  ',actlist
  179.     Store ' '+$(spact,1,4) to actlist
  180.   endif
  181.   Select primary
  182.   SKIP
  183. enddo
  184. Sel