home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1987 March & April / rerun-1987-03-04.d64 / dfprint (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  15KB  |  469 lines

  1. 10 iffl=0thenfl=1:load"dp] dos5.1",8,1
  2. 11 iffl=1thenfl=2:sys52224:rem(c)commodore
  3. 600 fore=0to24:poke54272+e,0:next:poke54296,15:goto1500
  4. 602 poke54277,58:poke54278,16:poke54273,35:poke54272,134
  5. 604 poke54276,33:fore=1to100:next:poke54276,16:return
  6. 1500 rem dfprint 1.7 for datafile (c)1983-1986 by mike konshak
  7. 1502 clr:print"[147][158]":poke53281,0:poke53280,0:open4,4:open3,3
  8. 1504 d$="":b$=chr$(32):forj=1to80:s$=s$+b$:nextj:pf=4:mf$=d$:rf$=d$:p=0
  9. 1506 nc=0:nl=0:pl=0:f1=0:f2=0:f3=0:l$=d$:rl=0:sb$=d$:cr$=chr$(13)
  10. 1508 a$=d$:c$=d$:t%=6:i=0:j=0:k=0:m=0:n=0:rw=5:sf=0:z=0:e$="eof"
  11. 1510 en=0:em$=d$:et=0:es=0:a1$=d$:a2$=d$:a3$=d$:rw=5:lw=34:lt=1:l=0
  12. 1512 rem-arrays
  13. 1514 dim ml$(17,4),pc(18),tt$(5),hc$(17),rp$(17,4),lp(5),r$(5)
  14. 1516 dim f$(31),t%(31),l%(31),rec$(31)
  15. 1518 lp(1)=1:lp(2)=37:lp(3)=73:lp(4)=109:goto1530
  16. 1520 rem-get
  17. 1521 print"[158]       press the appropriate key       ":return
  18. 1522 geta$:ifa$=""then1522
  19. 1524 return
  20. 1526 rem-start
  21. 1528 print"[147]       datafile fast print program     ":goto1548
  22. 1530 print"[147]       datafile fast print rev 1.7     "
  23. 1532 print"         by mike konshak (c)1986       "
  24. 1534 print"[153] this program will format and print a"
  25. 1536 print" seq[146] file, which was previously created"
  26. 1539 print" by [158]datafile[153][146], directly from the disk"
  27. 1540 print" to the printer.  the order of the"
  28. 1542 print" records will be the same as the most"
  29. 1544 print" recent sort as written in the current"
  30. 1546 print" file.":print"[158] press any key[146][158] to continue"
  31. 1547 gosub1522:gosub2856:goto1528
  32. 1548 printtab(5)"o[153][146]pen record file on disk"
  33. 1550 iffl>0thenprinttab(5)"r[153][146]epeat record file: [146]"nf$"[158][146]"
  34. 1551 printtab(5)"$[153][146] disk directory 4[153][146]"
  35. 1552 printtab(5)"q[153][146]uit program"
  36. 1553 print" transfer to:"
  37. 1554 printtab(5)"d[153][146] datafile dbms"
  38. 1555 printtab(5)"c[153][146] dfcalc calculated reports"
  39. 1556 gosub1521
  40. 1558 gosub1522:ifa$="$"ora$="4"thengosub1628:goto1528
  41. 1559 ifa$="d"thenprint"[147][144]load"chr$(34)"datafile 3.6"chr$(34)",8":goto1565
  42. 1560 ifa$="o"thenfl=1:goto1572
  43. 1561 ifa$="c"thenprint"[147][144]load"chr$(34)"dfcalc"chr$(34)",8":goto1565
  44. 1562 ifa$="r"then1584
  45. 1563 ifa$="q"thenclose5:close15:close3:close4:end
  46. 1564 gosub602:goto1558
  47. 1565 print:print:print:print:print"run[158]"
  48. 1566 poke631,19:poke632,13:poke633,13:poke634,13:poke635,13:poke636,13
  49. 1568 poke198,6:new:end
  50. 1570 rem-file name
  51. 1572 print"[153][147] available record files are:[158]":@"$0:df]*"
  52. 1573 print"[153]name of record file to be printed[158]"
  53. 1574 print"   ";nf$:input"[145] ";nf$:ifnf$=""thenfl=0:goto1528
  54. 1576 open15,8,15
  55. 1578 open5,8,5,"0:df] "+nf$+",s,r":gosub1618:ifen=62thengosub1620:fl=0:goto1528
  56. 1579 input#5,r,f,x:gosub1618:ifet=8then1528                              
  57. 1580 forn=1tof:input#5,f$(n),l%(n):nextn:gosub1618:ifet=8then1528        
  58. 1582 close5:close15                                                      
  59. 1583 rem-print menu
  60. 1584 print"[158][147]         record printout menu          "
  61. 1585 print"[153] print options:";:ifk<>0thenprint:goto1587
  62. 1586 print"[150]no formats present[158]"                                         
  63. 1587 printtab(4)"u[153][146]nformatted list"
  64. 1588 printtab(4)"r[153][146]eport format  [158]"rf$
  65. 1590 printtab(4)"m[153][146]ailing labels [158]"mf$
  66. 1591 print"[153] configure:"
  67. 1592 printtab(4)"l[153][146]abels:[158]"rw"[153]rows,[158]"lw"[153]chrs,[158]"lt"[153]across"
  68. 1594 printtab(4)"p[153][146]rinter: option[158]"p;:ifp=4thenprint"[157][157]screen[146]";
  69. 1595 print:printtab(4)"$[153][146] disk directory 4[153][146]"
  70. 1596 printtab(4)"e[153][146]xit to restart"
  71. 1598 gosub1521
  72. 1600 gosub1522:ifa$="" then1600
  73. 1602 ifa$="u"thenk=1:goto1730
  74. 1604 ifa$="r"thenk=2:goto3118
  75. 1605 ifa$="$"ora$="4"thengosub1628:goto1584
  76. 1606 ifa$="e"then1528
  77. 1608 ifa$="m"thenk=3:goto3118
  78. 1610 ifa$="l"then1940
  79. 1612 ifa$="p"thengosub2856:goto1584
  80. 1614 gosub602:goto1600
  81. 1616 rem-disk error
  82. 1618 input#15,en,em$,et,es:if(en<20)or(en=62)thenet=0:return
  83. 1620 print" [150]disk error[146]"en"[157], "em$","et"[157],"es"[158]":et=8
  84. 1622 print"[153] press any key[153][146] to restart program[158]"
  85. 1624 gosub1522:close5:close15:return
  86. 1626 rem-directory
  87. 1628 print"[147][158]";:@"$":printtab(25)"[153]press any key[158][146]":gosub1522:return
  88. 1666 rem-load report
  89. 1668 print"[153][147] available report files are[158]:":@"$0:rp]*"
  90. 1669 print"[153] name of report format file?[158]"
  91. 1670 print"   [158]";nf$:input"[145] ";rf$:ifrf$=""then1528
  92. 1672 open15,8,15:open5,8,5,"0:rp] "+rf$+",s,r":gosub1618:ifet=8then1528
  93. 1674 ifen=62thengosub1620:goto1528
  94. 1676 input#5,pw,nl,nc:gosub1618:ifet=8then1528
  95. 1678 forj=1tonl
  96. 1680 input#5,tt$(j):gosub1618:ifet=8then1528
  97. 1682 nextj
  98. 1684 fori=1tonc
  99. 1686 input#5,pc(i),hc$(i):gosub1618:ifet=8then1528
  100. 1688 forn=1to3
  101. 1690 input#5,rp$(i,n):gosub1618:ifet=8then1528                           
  102. 1692 nextn:nexti:input#5,a1$:z=val(a1$)
  103. 1694 s=st:ifs<>0then1698
  104. 1696 input#5,e$
  105. 1698 close5:close15
  106. 1700 goto2980
  107. 1702 rem-load label
  108. 1704 print"[153][147] available label files are:[158]":@"$0:ml]*"
  109. 1705 print"[153] name of mailing label format file?"
  110. 1706 print"   [158]";nf$:input"[145] ";mf$:ifmf$=""then1528
  111. 1708 open15,8,15:open5,8,5,"0:ml] "+mf$+",s,r":gosub1618:ifet=8then1528
  112. 1710 ifen=62thengosub1620:goto1528
  113. 1712 input#5,rw
  114. 1714 fori=1torw:forn=1to3
  115. 1716 input#5,ml$(i,n):gosub1618:ifet=8then1528
  116. 1718 nextn
  117. 1720 nexti
  118. 1722 s=st:ifs<>0then1726
  119. 1724 input#5,e$
  120. 1726 close5:close15:goto3068
  121. 1728 rem-open file
  122. 1730 print"[147] positioning drive..."
  123. 1731 open15,8,15:open5,8,5,"0:df] "+nf$+",s,r":gosub1618:ifet=8then1528  
  124. 1732 ifen=62thengosub1620:goto1528
  125. 1734 input#5,r,f,x:gosub1618:ifet=8then1528
  126. 1738 forn=1tof:input#5,f$(n),l%(n):nextn:gosub1618:ifet=8then1528
  127. 1740 rem-options
  128. 1742 a0=0:pg=1:pl=0:l=0:print"[147] [158]           print options menu        "
  129. 1743 print"[153] there are [158]"x"[146][153]records in [158]"nf$
  130. 1744 printtab(4)"a[153][146]ll records in file
  131. 1746 [153][163]4)"fprintwaitind records with common fields
  132. 1748 ifk=3andpf=4thenprinttab(4)"t[153][146]est label(s)"
  133. 1750 printtab(4)"e[153][146]xit back to start"
  134. 1752 ifk=2thenprint"[153]position paper in printer at top of page"
  135. 1754 gosub1521
  136. 1756 gosub1522
  137. 1758 ifa$="a"then1806
  138. 1762 ifa$="t"then1918
  139. 1764 ifa$="f"then1772
  140. 1766 ifa$="e"thenclose5:close15:goto3118
  141. 1768 gosub602:goto1756
  142. 1770 rem-find
  143. 1772 print"[158][147]     find records with common items    "
  144. 1774 forn=1tof:print" ";n;"[153][146] ";f$(n):nextn
  145. 1776 input" which field is to be searched";sf
  146. 1778 ifsf<0orsf>fthenprint"[145][145][145]":goto1776
  147. 1780 print"[153] enter common item[153][146] ":print" (the entire string is not required)"
  148. 1782 print" ";f$(sf);"[158][146] ";:inputt$
  149. 1784 print"[147]":ifk=2thengosub1838:gosub1852
  150. 1786 fori=1tox
  151. 1788 ifp<>4thenprint" searching record";i;"[145][145]"                         
  152. 1790 forn=1tof:input#5,rec$(n):ifrec$(n)=">"thenrec$(n)=" "
  153. 1791 nextn:gosub1618:ifet=8then1528
  154. 1792 ift$=left$(rec$(sf),len(t$))thenonkgosub1826,1870,1928:ifk=2thengosub1904
  155. 1796 nexti
  156. 1797 ifl>0andk=3thengosub1936
  157. 1798 close5:close15
  158. 1800 ifk=2then1906
  159. 1801 ifp=4thenprint"[153]press any key[158][146]":gosub1522
  160. 1802 goto1730
  161. 1804 rem-print all
  162. 1806 gosub2898:pl=0:print"[147][158]":ifp<>4andk=2thenprint"[147] printing heading"
  163. 1807 ifk=2thengosub1838:gosub1852
  164. 1808 fori=stox:ifp<>4thenprint"[145] reading record #"str$(i)" of"str$(x)    
  165. 1810 forn=1tof:input#5,rec$(n):ifrec$(n)=">"thenrec$(n)=" "
  166. 1811 nextn:gosub1618:ifet=8then1528
  167. 1812 onkgosub1826,1870,1928
  168. 1814 ifk=2thengosub1904
  169. 1816 nexti
  170. 1818 close5:close15
  171. 1820 ifk=2then1906
  172. 1822 goto1801
  173. 1824 rem-nonformatted
  174. 1826 print#pf,"[ record #";i;"   ]";:forj=1to61:print#pf,"-";:nextj:gosub2888
  175. 1828 pl=pl+1:forn=1tof
  176. 1830 print#pf,f$(n);:forj=1to20-len(f$(n)):print#pf,".";:nextj
  177. 1831 ifrec$(n)=">"thenrec$(n)=" "
  178. 1832 print#pf,rec$(n):pl=pl+1:nextn:gosub2888:pl=pl+1
  179. 1834 ifpl+f<=60thenreturn
  180. 1835 forj=1to65-pl:gosub2888:nextj:pl=0:pg=pg+1:print#pf,"page"pg:return 
  181. 1836 rem-title
  182. 1838 forj=1tonl:iftt$(j)<>">"thengosub1846                               
  183. 1842 nextj:return
  184. 1846 b=int((pw-l