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

  1. * Program MSPFILES- Performs special functions on MEMBERS or related files.
  2. Store T to LEVEL3
  3. Do while LEVEL3
  4.   Erase
  5.   @ 1,1 say chname
  6.   @ 1,62 say curdate
  7.   @ 2,1  say 'DATA DISK = '+D
  8.   @ 3,20 say  '  Special File Creation, Reports '
  9.   @ 3,66 SAY '6-/MSPFILES/'
  10.   @ 5,10 say '1)  Display people from a selected file, group'
  11. @ 6,10 say '2)  Print Full-Information Report of a selected file, group   [FI]'
  12. @ 7,10 say '3)  Print One-Line Report of a selected file, group           [OL]'
  13. @ 8,10 say '4)  Print Mailing Labels of a selected file, group            [ML]'
  14.   @ 9,10 say '5)  Create a new Special File from selected file, criteria'
  15.   @ 10,10 say '6)  Generate FCMEMBRS file (families), with index'
  16.   @ 11,10 say '7)  Generate MSCROST file (Small Churches), with index'
  17.   @ 12,10 say '8)  Generate MACTIVTY file (Special Activities), with index'
  18.   @ 13,10 say '9)  Generate MSKILLS file (Interests/Abilities), with index'
  19.   @ 14,10 SAY 'A)  Generate SCMEMBRS index file to MEMBERS file.'
  20.   @ 15,10 say 'B)  Generate OFFERNDX index file to MEMBERS file.'
  21.   ?
  22.   Accept '           Enter selection ' to FSEL
  23.   ?
  24. Store F to valid1
  25. Do while .not. valid1
  26.   Store T to valid1
  27.   Do CASE
  28.     CASE FSEL = '6'
  29.       Do MGFCROST.CMD
  30.       Store F to SFMORE
  31.     CASE FSEL = '7'
  32.       Do MGSCROST.CMD
  33.       Store F to SFMORE
  34.     CASE FSEL = '8'
  35.       Do MGSAROST.CMD
  36.       Store F to SFMORE
  37.     CASE FSEL = '9'
  38.       Do MGIAROST.CMD
  39.       Store F to SFMORE
  40.     CASE !(FSEL)='A'
  41.       Store F to SFMORE
  42.       Store d+':MEMBERS' to mfile
  43.       STORE D+':SCMEMBRS' TO MFILENDX
  44.       IF FILE(MFILENDX)
  45.         ? 'Now deleting old SCMEMBRS file index.'
  46.         DELETE file &MFILENDX
  47.       endif
  48.       USE &MFILE
  49.     ? 'Now indexing MEMBERS file by SS:SC:MEMB, creating file index SCMEMBRS.'
  50.         Set talk on
  51.         Index on ss:sc:memb+last:name+first:name to &MFILENDX
  52.         Set talk off
  53.         Accept 'Indexing is complete. Press <RETURN> ' to XX
  54.     CASE !(FSEL)='B'
  55.       Store F to SFMORE
  56.       Store d+':MEMBERS' to MFILE
  57.       Store d+':OFFERNDX.NDX' to MFILENDX
  58.       If file(MFILENDX)
  59.         ? 'Now deleting old OFFERNDX file index.'
  60.         DELETE file &MFILENDX
  61.       endif
  62.       Use &MFILE
  63.      ? 'Now indexing MEMBERS file by OFFERINGEN, creating file index OFFERNDX.'
  64.       Set talk on
  65.       Index on offeringen to &MFILENDX
  66.       SET TALK off
  67.       Accept 'Indexing is complete. Press <RETURN> ' to XX
  68.     CASE FSEL='1' .or. FSEL='2' .or. FSEL='3' .or. FSEL='4' .or. FSEL='5'
  69.       Store T to SFMORE
  70.     CASE !(FSEL)='Q'
  71.       RETURN
  72.     OTHERWISE
  73.       Accept 'Invalid entry. Please enter again ' to FSEL
  74.   ENDCASE
  75. ENDDO
  76. If SFMORE
  77.   Store 'ANAME1' to ANAME
  78.   Store 'ALL' to ANAME1
  79.   Store "$(MEMBSTATUS,2,1)='*'" to BNAME
  80.   ? ' Select Input File -'
  81.   ? '    1. Full-Church                       [MEMBERS]'
  82.   ? '    2. Full-Church, Families             [FCMEMBRS--FCMEMBRS]'
  83.   ? '    3. Small Church - children, singles  [MSCROST]'
  84.   ? '    4. Small Church - marrieds           [FCMEMBRS--FCRSCNDX]'
  85.   ? '    5. Special Activities                [MACTIVTY]'
  86.   ? '    6. Interests / Abilities             [MSKILLS]'
  87.   ? '    7. Special File                      [-- ? --]'
  88.   ?
  89.   Accept 'Enter selection ' to XSEL
  90.   Store F to valid1
  91.   Do while .not. valid1
  92.    Store T to valid1
  93.    Do CASE
  94.     CASE XSEL='1'
  95.       Store d+':MEMBERS index '+d+':MEMBERS' to INFILE
  96.       If .not. file(INFILE)
  97.         Accept 'MEMBERS file is missing. Press <retn> to exit.' to XX
  98.         RETURN
  99.       endif
  100.     CASE XSEL='2' .or. XSEL='4'
  101.       Store 0 to offeringen
  102.       Store ' ' to sp:activty
  103.       Store ' ' to ss:sc:memb
  104.       Store ' ' to skills
  105.       Store ' ' to teach:sssc
  106.       Store ' ' to other
  107.       Store ' ' to comments
  108.       Store d+':FCMEMBRS' to infile
  109.       If XSEL='2'
  110.         Store d+':FCMEMBRS.NDX' to OUTFILE
  111.       else
  112.         Store d+':FCRSCNDX.NDX' to OUTFILE
  113.         Store 'ss:sc:memb' to ANAME
  114.       endif
  115.       If (.not. file(INFILE)) .or. (.not. file(OUTFILE))
  116.         ? 'File',INFILE,'must be created.'
  117.         Do MGFCROST.CMD
  118.       endif
  119.       Store infile+' index '+outfile to infile
  120.       Use &INFILE
  121.     CASE XSEL='3'
  122.       Store d+':MSCROST index '+d+':MSCROST' to INFILE
  123.       If .not. file(INFILE)
  124.         ? 'File',INFILE,'must be created.'
  125.         Do MGSCROST.CMD
  126.       endif
  127.       Use &INFILE
  128.       Store 'SS:SC:MEMB' to ANAME
  129.     CASE XSEL='5'
  130.       Store d+':MACTIVTY index '+d+':MACTIVTY' to INFILE
  131.       If .not. file(INFILE)
  132.         ? 'File',infile,'must be created.'
  133.         Do MGSAROST.CMD
  134.       endif
  135.       USE &INFILE
  136.       Store 'SP:ACTIVTY' to ANAME
  137.     CASE XSEL='6'
  138.       Store d+':MSKILLS index '+d+':MSKILLS' to INFILE
  139.       If .not. file(INFILE)
  140.         ? 'File',INFILE,'must be created.'
  141.         Do MGSAROST.CMD
  142.       endif
  143.       Use &INFILE
  144.       Store 'SKILLS' to ANAME
  145.     CASE XSEL='7'
  146.       Accept 'Enter desired source file name ' to XX
  147.       Store d+':&XX' to INFILE
  148.       Do while .not. file(INFILE) .and. SFMORE
  149.         If !(XX)='Q'
  150.           Store F to SFMORE
  151.         else
  152.         Accept 'This file does not exist on the data disk. Enter again ' to XX
  153.         Store d+':&XX' to INFILE
  154.         endif
  155.       enddo
  156.     CASE !(XSEL)='Q'
  157.       Store F to SFMORE
  158.     OTHERWISE
  159.       Accept 'Invalid entry. Please enter again ' to XSEL
  160.       Store F to valid1
  161.     ENDCASE
  162.     If .not. file(INFILE) .and. SFMORE
  163.       ? 'Source file',INFILE,'not found.'
  164.       Store F to valid1
  165.     endif
  166.   ENDDO
  167.   If SFMORE
  168.    If FSEL='5'
  169.     Accept 'Enter your new Special File name ' to OUTFILE
  170.     If !(OUTFILE)='Q'
  171.       Store F to SFMORE
  172.     else
  173.       Store d+':&OUTFILE' to OUTFILE
  174.       Store 'Y' to XX
  175.       If file(OUTFILE)
  176.         ? '         File',OUTFILE,'already exists.'
  177.         Accept '         Do you want it written over? ' to XX
  178.       endif
  179.       If !(XX)='Y'
  180.         Accept 'Enter selection criteria ' to SELCRI
  181.         USE &INFILE
  182.         ? 'Now copying selected records from',INFILE,'to',OUTFILE
  183.         Set talk on
  184.         Copy to &OUTFILE for &SELCRI
  185.         Set talk off
  186.         Use &outfile
  187.         USE
  188.       endif
  189.       Store F to SFMORE
  190.     endif
  191.    else
  192.    If XSEL='3' .or. XSEL='4' .or. XSEL='5' .or. XSEL='6'
  193.     USE &INFILE
  194.     Accept 'Enter group code (press <retn> for "all") ' to YSEL
  195.     Store F to valid2
  196.     Do while .not. valid2
  197.      Store T to valid2
  198.      If YSEL<>' '
  199.       If !(YSEL)='Q'
  200.         Store F to valid2
  201.         Store F to SFMORE
  202.       else
  203.         Find &YSEL
  204.         If #=0
  205.           Accept 'Group code not found. Please enter again ' to YSEL
  206.           Store F to valid2
  207.         else
  208.           Store YSEL to ANAME1
  209.         endif
  210.       endif
  211.      endif
  212.     enddo
  213.   endif
  214.   If SFMORE
  215.   Accept 'Enter selection criteria ' to SELCRI
  216.   If SELCRI=' '
  217.     Store '*' to BNAME
  218.   else
  219.     Store '.not. ('+SELCRI+')' to BNAME
  220.   endif
  221.   Store 'Sm. Church' to fcolhdr
  222.   Store 'ss:sc:memb' to FCOLUMN
  223.   Do CASE
  224.     CASE FSEL='1'
  225.       Use &INFILE
  226.       ?
  227. ? 'Report for ',INFILE,' file, with selection criteria: ',SELCRI
  228.       Store T to beginng
  229.       Store '                  ' to spaces
  230.       Do while &ANAME=ANAME1 .and. .not. EOF
  231.         If .not. beginng
  232.           Store trim(first:name)+' '+trim(last:name) to names
  233.           If len(names) > 17
  234.             Store $(names,1,18) to names
  235.           else
  236.             Store 18-len(names) to lenn
  237.             Store names+$(spaces,1,lenn) to names
  238.           endif
  239.           Store $(membstatus,1,2)+$(sp:activty,1,8) to xfields
  240.          ? $(ss:sc:memb,1,3),xfields,names,home:phone,address,$(city:state,1,8)
  241.           SKIP
  242.         endif
  243.         Store F to beginng
  244.         Do while .not. EOF .and (* .or. &BNAME)
  245.           SKIP
  246.         enddo
  247.       enddo
  248.     CASE FSEL='2'
  249.       Accept 'Enter first line title ' to CNAME
  250.       Store INFILE to MFILE
  251.       Do FCREPT1.CMD
  252.     CASE FSEL='3'
  253.       Accept 'Enter first line title ' to ACTVNAME
  254.       If ANAME1='ALL'
  255.         Use &INFILE
  256.       endif
  257.       Do MONELINE.CMD
  258.     CASE FSEL='4'
  259.       Store INFILE to SPFILE
  260.       Do MSPFMAIL.CMD
  261.   ENDCASE
  262.   endif
  263.  endif
  264. endif
  265. Accept 'Special file operation is complete. Press <retn> ' to XX
  266. ENDDO
  267. Use
  268. RETURN.CMD
  269.       endif
  270.       Use &INFILE
  271.       Store 'SS:SC:MEMB' to ANAME
  272.     CASE XSEL='5'
  273.       Store d+':MACTIVTY index '+d+':MACTIVTY' to INFILE
  274.       If .not. file(INFILE)
  275.         ? 'File',infile,'must be created.'
  276.         Do MGSAROST.CMD
  277.       endif
  278.       USE &INFILE
  279.       Store 'SP:ACTIVTY' to ANAME
  280.     CAS