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

  1. * Program MUPADD - Allows adding a record to MEMBERS file, checking validity.
  2. Store ' ' to INHH
  3. Do while !(INHH)<>'Q'
  4. Erase
  5. @ 2,10 say 'Adding a new person to MEMBERS file.'
  6. @ 4,0 say "Enter person's place in family: "
  7. @ 5,3 say '[H]ead-of-household, [M]ember-of-family, [S]ingle person, '
  8. @ 6,3 say 'followed by sex designator - 1=Man, 2=Woman, 3=Boy, 4=Girl'
  9. @ 7,3 say 'Examples:  h1 = Man, head-of-household '
  10. @ 8,3 say '           m4 = Girl, member of preceeding family'
  11. Accept 'Enter 2-character code ' to INHH
  12. Store F to VALID1
  13. Store T to invalcc
  14. Do while invalcc
  15.   Store !($(INHH,1,1)) to INHHC
  16.   If INHHC = 'Q'
  17.     Store F to invalcc
  18.     Return
  19.   else
  20.   If len(INHH) = 2
  21.     Store val($(INHH,2,1)) to C2INHH
  22.     Store F to VALID1
  23.     If INHHC = 'H' .or. INHHC = 'M' .or. INHHC = 'S'
  24.       Store T to VALID1
  25.     endif
  26.     If C2INHH > 0 .and. C2INHH < 5
  27.       If Valid1
  28.         Store F to INVALCC
  29.       endif
  30.     endif
  31.   endif
  32.   If INVALCC
  33. Accept 'Invalid entry. (2 characters, H/M/S 1/2/3/4) Please re-enter ' to INHH
  34.   endif
  35.   endif
  36. enddo
  37. Store !($(INHH,2,1)) to INH2
  38. Store !($(INHH,1,1)) to INH1
  39. Store ' ' to FCODE9
  40. If INH1='H' .or. (INH1='M' .and. INH2='2')
  41.   Store 'M' to FCODE9
  42. endif
  43. Store 'N' to XX
  44. If INH1 = 'M' .and. len(lastname) > 1
  45.   Store T to MATCHING
  46.   Do while MATCHING
  47.     ? LASTNAME,HOMEPHONE
  48.     Accept ' FIRST NAME ' to firstname
  49.     Accept '    Ok? ' to XX
  50.     If !(XX) = 'Y' .or. !(XX) = 'Q' .or. xx=' '
  51.       Store F to MATCHING
  52.     endif
  53.   enddo
  54. endif
  55. If !($(XX,1,1)) = 'N'
  56. Store T to MATCHING
  57. Do while MATCHING
  58.   Store '                 ' to lastname
  59.   Store ' ' to firstname
  60.   Store ' ' to homephone
  61.   Accept '  LAST NAME  ' to lastname
  62.   Accept '  FIRST NAME ' to firstname
  63.   Accept '  HOME PHONE ' to homephone
  64.   Accept '     Ok? ' to XX
  65.   If !($(XX,1,1)) = 'Q' .or. !($(XX,1,1)) = 'Y' .or. xx=' '
  66.     Store F to MATCHING
  67.   endif
  68. enddo
  69. endif
  70. If !($(XX,1,1)) <> 'Q'
  71.   Store F to MATCH
  72.   Store T to MATCHING
  73.   Find &lastname
  74.   If # = 0
  75.     Store F to MATCHING
  76.   else
  77.     Do while MATCHING .and. last:name=lastname .and. .not. EOF
  78.       If first:name = firstname
  79.         If len(trim(homephone)) = 1 .or. home:phone = homephone
  80.           Store T to MATCH
  81.           Store F to MATCHING
  82.         endif
  83.       endif
  84.       If .not. MATCH
  85.         SKIP
  86.       endif
  87.     enddo
  88.   endif
  89.   If MATCH
  90.     Store T to INVALCC
  91.   Accept ' Duplicate name found.  Do you want to edit it? [Y/N/D] ' to INNF
  92.     Do while INVALCC
  93.  Store F to invalcc
  94.  Do case
  95.    CASE !(INNF) = 'Q'
  96.      Store F to MATCHING
  97.    CASE !(INNF) = 'Y'
  98.      Store # to recnumb
  99.      Store 'A' to ESEL
  100.      Store 'y' to XSELECT
  101.      Do MUPEDIT.CMD
  102.      If INH1 = 'H'
  103.        Store Address to xaddress
  104.        Store CITY:STATE to xcityst
  105.        Store ZIP to XZIP
  106.        Store HOME:PHONE to homephone
  107.        Store LAST:NAME to lastname
  108.        Store FAMILYCODE to XFAMCODE
  109.      endif
  110.    CASE !(INNF) = 'N' .or. !(INNF) = 'D'
  111.      Store F to MATCHING
  112.    OTHERWISE
  113.      Accept 'Enter [Y/N/D] only ' to INNF
  114.    ENDCASE
  115.    enddo
  116.   endif
  117.   If .not. MATCH
  118.   If !(INH1) <> 'M' .or. len(xaddress)=1
  119.     * First determine the FAMILYCODE, if not family member
  120.     Store !($(lastname,1,3)) to lastcode
  121.     Store !($(firstname,1,1)) to firstcode
  122.       Store 0 to curfnum
  123.       Store $(lastname,1,3) to lastnam
  124.       Find &lastnam
  125.       If # = 0
  126.         Store F to MATCHING
  127.       else
  128.         Store F to LOCATING
  129.         Store T to MATCHING
  130.         Do while MATCHING .and. .not. EOF
  131.           If FAMILYCODE=lastcode
  132.         If $(FAMILYCODE,4,1) = firstcode .and. val($(familycode,5,3)) > curfnum
  133.               Store val($(familycode,5,3)) to curfnum
  134.             endif
  135.           else
  136.             Store F to MATCHING
  137.           endif
  138.           SKIp
  139.         enddo
  140.       endif
  141.       STORE CURFNUM+1 TO CURFNUM
  142.       If curfnum > 999
  143. Store !($(lastcode,1,1))+'... '+$(lastcode,2,2)+'... '+firstcode+'...' to FC
  144.         ? 'Family code values have run out for ',FC
  145.         ? 'Operator must perform family-code re-numbering for this code only.'
  146.         Accept 'Press <retn> for next update.' to XX
  147.         RETURN
  148.       endif
  149.     endif
  150.     Do MUPADD1.CMD
  151.   endif
  152. endif
  153. enddo
  154. RETURN
  155. queries in starting this report.
  156.          The  report uses the SP:ACTIVTY field for the variable item in  the 
  157.          report.
  158.  
  159.      3) [OL]: One-line report, by offering envelope number MEMBERS /OFFERNDX
  160.          This  report  is good for keeping track of your  assigned  envelope 
  161.          numbers.   It  shows each number in order,  then the  name  of  the 
  162.          person(s)  that  have that envelope set.   Unassigned  numbers  are 
  163.          printed with the space left blank after them.  You can ore val($(INHH,2,1)) to C2INHH
  164.     Store F to VALID1
  165.     If INHHC = 'H' .or. INHHC = 'M' .or. INHHC = 'S'
  166.       Store T to VALID1
  167.     endif
  168.     If C2INHH > 0 .and. C2INHH < 5
  169.       If Valid1
  170.         Store F to INVALCC
  171.       endif
  172.     endif
  173.   endif
  174.   If INVALCC
  175. Accept 'Invalid entry. (2 characters, H/M/S 1/