home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / labelmkr.zip / LABELPT1.CMD < prev   
OS/2 REXX Batch file  |  1987-02-14  |  5KB  |  159 lines

  1. *
  2. *
  3. *        Labelprt.Cmd  Label Printing Command File
  4. *
  5. *            by Micheal R. Abram
  6. *                     11/20/81
  7. *              (rev. 07/11/82)
  8. *        
  9. *            From October, 1982  Lifelines
  10. *
  11. *
  12. *        This dBASE II command file will print labels several across
  13. *    the page.  It expects a .DBF file in USE positioned at the first
  14. *    record to print, and will print to the end of the file.  The
  15. *    fields expected are:
  16. *        Field    Type    Comment
  17. *        Name    C    Name-flipping a la NAD.  "Abram*Micheal R."
  18. *                Last name, asterisk, first name.  This 
  19. *                               allows you to sort or index on Name.
  20. *        Addr1    C    Use for second name, affiliation, or
  21. *                comment:  If the first column is blank,
  22. *                the line will not be printed and the next
  23. *                lines will move up.
  24. *        Addr2    C    Street Address
  25. *        City    C    The length of City, State, and Zip may
  26. *        State    C    not total more than five less than the
  27. *        Zip    C    horizontal spacing between labels, or
  28. *                City will be truncated.
  29. *        The horizontal increment specified must be at least one more
  30. *    than the lenght of the longest field, or truncation will occure.
  31. *
  32. *
  33. SAVE TO LABELPRT
  34. SET TALK OFF
  35. SET EXACT OFF
  36. ERASE
  37. STORE '                                                ' TO Blanks
  38. STORE 1 TO Perrec
  39. STORE 2 TO Nwide
  40. STORE 35 TO Hinc
  41. STORE 6 TO Vinc
  42. @  9,10 SAY '  labelprint.cmd -- Label printing Command File'
  43. @ 10,10 SAY ' How many labels for each name?             ' GET Perrec PICT '9'
  44. @ 11,10 SAY ' How many labels across the form?           ' GET Nwide PICT '9'
  45. @ 12,10 SAY ' What is the horizontal spacing in columns? ' GET Hinc PICT '99'
  46. @ 13,10 SAY ' What is the vertical spacing in lines?     ' GET Vinc PICT '9'
  47. READ
  48. STORE Hinc-1 TO Maxname
  49. STORE Hinc-1 TO Maxaddr1
  50. STORE Hinc-1 TO Maxaddr2
  51. STORE Hinc-(LEN(State)+LEN(Zip)+5) TO Maxcity
  52. STORE 'Y' TO Offer
  53. DO WHILE !(Offer) = 'Y'
  54.     @ 20,10 SAY 'Print a line of dummy labels? (Y or N)' GET Offer
  55.         READ
  56.     IF !(Offer) = 'Y'
  57.         SET CONSOLE OFF
  58.         SET PRINT ON
  59.         STORE Nwide TO N
  60.         DO WHILE N > 0
  61.             ?? ' Name'+$(Blanks,1,Hinc-6)
  62.             STORE N-1 TO N
  63.         ENDDO
  64.         ?
  65.         ?
  66.         ?
  67.         STORE Nwide TO N
  68.         DO WHILE N > 0
  69.             ?? ' City'+$(Blanks,1,Hinc-6)
  70.             STORE N-1 TO N
  71.         ENDDO
  72.         STORE Vinc-4 TO N
  73.                 DO WHILE N > 0
  74.                        ?
  75.                        STORE N-1 TO N
  76.                 ENDDO
  77.                 SET PRINT OFF
  78.                 SET CONSOLE ON
  79.         ENDIF
  80. ENDDO
  81. *
  82. * labelprt.cmd
  83. STORE 0 TO Reccount
  84. STORE 0 TO Lpr
  85. DO WHILE .NOT. EOF
  86.         STORE ' ' TO Mline1
  87.         STORE ' ' TO Mline2
  88.         STORE ' ' TO Mline3
  89.         STORE ' ' TO Mline4
  90.     STORE 0 TO N
  91.         DO WHILE N < Nwide
  92.         DO CASE
  93.            CASE EOF
  94.             STORE Nwide TO N
  95.            CASE Lpr < Perrec
  96.             STORE LEN(Mline1) TO Length
  97.             IF '*' $ Name
  98.                 STORE Mline1;
  99.                  +$(TRIM($(Name,@('*',Name)+1,Hinc));
  100.                  +' '+$(Name,1,@('*',Name)-1),1,Maxname);
  101.                  TO Mline1
  102.             ELSE
  103.                 STORE Mline1+$(Name,1,Maxname) TO Mline1
  104.             ENDIF
  105.             STORE Mline1+$(Blanks,1,Hinc-(LEN(Mline1)-Length));
  106.               TO Mline1
  107.             IF Addr1 = ' '
  108.                  STORE 'Mline2' TO Maddr2
  109.                                  STORE 'Mline3' TO Mcity
  110.                                  STORE Mline4+$(Blanks,1,Hinc) TO Mline4
  111.                         ELSE
  112.                                  STORE LEN(Mline2) TO Length
  113.                                  STORE Mline2+$(Addr1,1,Maxaddr1) TO Mline2
  114.                                  STORE Mline2+$(Blanks,1,;
  115.                                     Hinc-(LEN(Mline2)-Length)) TO Mline2
  116.                                  STORE 'Mline3' TO Maddr2
  117.                                  STORE 'Mline4' TO Mcity
  118.                         ENDIF
  119.                         STORE LEN(&Maddr2) TO Length
  120.                         STORE &Maddr2+$(Addr2,1,Maxaddr2) TO &Maddr2
  121.                         STORE &Maddr2+$(Blanks,1,Hinc-(LEN(&Maddr2)-Length));
  122.                           TO &Maddr2
  123.                         STORE LEN(&Mcity) TO Length
  124.                         STORE &Mcity+TRIM($(City,1,Maxcity))+', '+State+'  ';
  125.               +Zip TO &Mcity
  126.             STORE &Mcity+$(Blanks,1,Hinc-(LEN(&Mcity)-Length));
  127.               TO &Mcity
  128.             STORE N+1 TO N
  129.             STORE Lpr+1 TO Lpr
  130.            OTHERWISE
  131.             SKIP
  132.             STORE Reccount+1 TO Reccount
  133.             STORE 0 TO Lpr
  134.         ENDCASE
  135.     ENDDO
  136.     SET CONSOLE OFF
  137.     SET PRINT ON
  138.     ? Mline1
  139.     ? Mline2
  140.     ? Mline3
  141.     ? Mline4
  142.     STORE Vinc-4 TO N
  143.     DO WHILE N > 0
  144.         ?
  145.         STORE N-1 TO N
  146.     ENDDO
  147.     SET PRINT OFF
  148.     SET CONSOLE ON
  149. ENDDO
  150. @ 14,10 SAY 'There were '
  151. @ 14,22 SAY Reccount USING '99999'
  152. @ 14,28 SAY 'records processed '
  153. @ 15,10 SAY '       and '
  154. @ 15,22 SAY Reccount*Perrec USING '99999'
  155. @ 15,28 SAY ' labels printed.   '
  156. RESTORE FROM LABELPRT
  157. DELETE FILE LABELPRT.MEM
  158. RETURN
  159.