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

  1. * Program MSPFMAIL - Prints mailing labels for a specified file of people.
  2. * MLABLSPP (labels-per-page)
  3. * MLSPACNG (spacing between labels) - must be > 2
  4. * MLCOL1 (column number for 1st column of labels)
  5. * MLCOL2 (column number for 2nd column of labels; Equals 0 if only 1-col labels
  6. * C       - running current column
  7. * MAXLINE - computed maximum CURLINE count
  8. *
  9. Select secondary
  10. USE MDIRFILE index MDIRFILE
  11. GOTO 19
  12. Store val($(spact,28,2)) to MLSPACNG
  13. SKIP
  14. Store val($(spact,28,2)) to MLINESPP
  15. SKIP
  16. Store val($(spact,27,2)) to MLCOL1
  17. SKIP
  18. Store val($(spact,29,2)) to MLCOL2
  19. SKIP
  20. Store val($(spact,16,2)) to voteage
  21. USE
  22. STORE MLINESPP-1 TO MAXLINE
  23. Store 'Mailing labels: ' to HML
  24. Store str(MLINESPP,2) to mlax
  25. Store str(MLSPACNG,2) to Mlsx
  26. STORE STR(MLCOL1,2) TO ML11X
  27. STORE STR(MLCOL2,2) TO ML22X
  28. Set RAW on
  29. If MLCOL2>0
  30.   STORE ML11X+',  2ND COLUMN = '+STR(MLCOL2,2) TO ML11X
  31. endif
  32. ? HML,MLAX,' LINES / PAGE, SPACING = ',MLSX,', 1ST COLUMN = ',ML11X
  33. Set RAW off
  34. Set format to print
  35. Select primary
  36. Use &SPFILE
  37. If ANAME1<>'ALL'
  38.   Find &ANAME1
  39.  If #=0
  40.   Accept 'No records found with this code. Press <retn> ' to XX
  41.   Return
  42.  endif
  43. endif
  44. Store T to BEGINNG
  45. Store 0 to CURLINE
  46. Store '1' to C
  47. Store ' ' to XZIP
  48. Do while .not. EOF .AND. &ANAME=ANAME1
  49.   If .not. BEGINNG
  50.  If fullzip='Y'
  51.    Store zone to xzip
  52.  endif
  53. If MLCOL2=0
  54.   @ curline,MLCOL1 say TRIM(FIRST:NAME)+' '+TRIM(LAST:NAME)
  55.   @ curline+1,MLCOL1 say ADDRESS
  56.   @ curline+2,MLCOL1 say TRIM(CITY:STATE)+' '+ZIP+xzip
  57.   Store curline+MLSPACNG to curline
  58. else
  59.   Store trim(first:name)+' '+trim(last:name) to NAMEC&C
  60.   Store address to ADDRC&C
  61.   Store trim(city:state)+' '+zip+xzip to CITYC&C
  62.   If C='2'
  63.     @ curline,MLCOL1 say NAMEC1
  64.     @ curline,MLCOL2 say NAMEC2
  65.     @ curline+1,MLCOL1 say ADDRC1
  66.     @ curline+1,MLCOL2 say ADDRC2
  67.     @ curline+2,MLCOL1 say CITYC1
  68.     @ curline+2,MLCOL2 say CITYC2
  69.     Store curline+MLSPACNG to curline
  70.     Store '1' to C
  71.   else
  72.     Store '2' to C
  73.   endif
  74. endif
  75. If curline>MAXLINE
  76.   EJECT
  77.   Store 0 to curline
  78. endif
  79.     SKIP
  80.   endif
  81.   Store F to BEGINNG
  82.   Do while .not. EOF .and. (* .or. &BNAME)
  83.     SKIP
  84.   enddo
  85. enddo
  86. If C='2' .and. MLCOL2>0
  87.   @ CURLINE,MLCOL1 SAY NAMEC1
  88.   @ CURLINE+1,MLCOL1 SAY ADDRC1
  89.   @ CURLINE+2,MLCOL1 SAY CITYC1
  90. endif
  91. EJECT
  92. USE
  93. Set format to screen
  94. Release ANAME,ANAME1,XX,XNAME,MLSPACNG,MLINESPP,MLCOL1,MLCOL2,MAXLINE,HML,XZIP
  95. RELEASE MLAX,MLSX,ML11X,ML22X,BEGINNG,CURLINE,C,NAMEC1,NAMEC2,ADDRC1,ADDRC2
  96. RELEASE CITYC1,CITYC2,SPFILE,YEARVAL,VOTEDATE,YEARSTR,INBDATE,BNAME
  97. RETURN
  98. 'ALL'
  99.   Find &ANAME1
  100.  If #=0
  101.   Accept 'No records found with this code. Press <retn> ' to XX
  102.   Return
  103.  endif
  104. endif
  105. Store T to BEGINNG
  106. Store 0 to CURLINE
  107. Store '1' to C
  108. Store ' ' to XZIP
  109. Do while .not. EOF .AND. &ANAME=ANAME1
  110.   If .not. BEGINNG
  111.  If fullzip='Y'
  112.    Store zone to xzip
  113.  endif
  114. If MLCOL2=0
  115.   @ curline,MLCOL1 say TRIM(FIRST:NAME)+' '+TRIM(LAST:NAME)
  116.   @ curline+1,MLCOL1 say ADDRESS
  117.   @ curline+2,MLCOL1 say TRIM(CITY:STATE)+' '+ZIP+xzip
  118.   Store c