home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol110 / labelpt2.cmd < prev    next >
Encoding:
Text File  |  1984-04-29  |  4.5 KB  |  158 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. *                street address. 
  22. *        Addr2    C    Second address line. If the first column
  23. *                               is blank, the line will not be printed 
  24. *                               and the next lines will moved up.
  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.                         STORE LEN(Mline2) TO Length
  108.                         STORE Mline2+$(Addr1,1,Maxaddr1) TO Mline2
  109.                         STORE Mline2+$(Blanks,1,Hinc-(LEN(Mline2)-Length));
  110.                           TO Mline2
  111.             IF Addr2 = ' '
  112.                                  STORE 'Mline3' TO Mcity
  113.                                  STORE Mline4+$(Blanks,1,Hinc) TO Mline4
  114.                         ELSE
  115.                                  STORE LEN(Mline3) TO Length
  116.                                  STORE Mline3+$(Addr2,1,Maxaddr2) TO Mline3
  117.                                  STORE Mline3+$(Blanks,1,;
  118.                                     Hinc-(LEN(Mline3)-Length)) TO Mline3
  119.                                  STORE 'Mline4' TO Mcity
  120.                         ENDIF
  121.                         STORE LEN(&Mcity) TO Length
  122.                         STORE &Mcity+TRIM($(City,1,Maxcity))+', '+State+'  ';
  123.               +Zip TO &Mcity
  124.             STORE &Mcity+$(Blanks,1,Hinc-(LEN(&Mcity)-Length));
  125.               TO &Mcity
  126.             STORE N+1 TO N
  127.             STORE Lpr+1 TO Lpr
  128.            OTHERWISE
  129.             SKIP
  130.             STORE Reccount+1 TO Reccount
  131.             STORE 0 TO Lpr
  132.         ENDCASE
  133.     ENDDO
  134.     SET CONSOLE OFF
  135.     SET PRINT ON
  136.     ? Mline1
  137.     ? Mline2
  138.     ? Mline3
  139.     ? Mline4
  140.     STORE Vinc-4 TO N
  141.     DO WHILE N > 0
  142.         ?
  143.         STORE N-1 TO N
  144.     ENDDO
  145.     SET PRINT OFF
  146.     SET CONSOLE ON
  147. ENDDO
  148. ERASE
  149. @ 14,10 SAY 'There were '
  150. @ 14,22 SAY Reccount USING '99999'
  151. @ 14,28 SAY 'records processed '
  152. @ 15,10 SAY '       and '
  153. @ 15,22 SAY Reccount*Perrec USING '99999'
  154. @ 15,28 SAY ' labels printed.   '
  155. RESTORE FROM LABELPRT
  156. DELETE FILE LABELPRT.MEM
  157. RETURN
  158.