/* This program is a general-purpose label printer. It will handle from 1-across through 4-across labels, and can easily be extended to handle more. It depends on LABELS.FD and LABELS.DAT, which are read as file 1, and set up like this: 1,1 # across (1 - 4) labels per page 1,2 # deep (1 - 6) lines per label 1,3 - 1,6 starting col, left edge of each label 1,7 - 1,16 line # 1 - 10 1,17 - 1,26 col # 1 - 10 1,27 - 1,36 field # 1 - 10 The variables used and their meanings: F last file read R record # across line being handled L current line # S current spec # - refers to line, col, field # X line within current spec Y col within current spec Z field # within current spec */ input (labels, labels; /* the rest of the input files are to be filled in automatically */ data,data; dummy,data; dummy,data; dummy,data; dummy,data) output () clear; display "Printing labels ..."; 1,1 = 1,1 + 2; /* max record to "read" */ 1,(3-6) = 1,(3-6) - 1; /* The idea here is to read file 2 and move the records into the dummy areas set up, as many as requested by the definition in LABELS.DAT */ begin: F = 3; readloop: if F > 1,1 call labels; goto begin; endif read 2; rmove F,2; if end 2 goto EOF; endif F = F + 1; goto readloop; EOF: Š /* end of file on file F */ if F != 3 call labels; /* print the spill-over */ endif stop; labels: L = 1; /* current line */ lloop: /* loop until L > lines deep */ if L > 1,2 return; endif call printline; /* print 1 line */ L = L + 1; goto lloop; printline: /* print 1 line */ S = 0; /* current spec */ ploop: /* we will overprint each spec on the same line until all specs done, then skip to next line. */ S = S + 1; if S > 10 skip; return; endif X = S + 6; X = 1,X; /* line # this spec */ if X = L /* if this spec is for this line */ call printspec; endif goto ploop; printspec: /* print one specification */ R = 2; /* record # to print from */ psloop: R = R + 1; if R = F /* then we've done all records */ print at(0) '\r'; /* overprint each spec */ return; endif Y = S + 16; Y = 1,Y + 1,R; /* column # */ /* 1,R is offset for the start of this label */ Z = S + 26; /* Z is field # to print */ print at(Y) R,(1,Z); goto psloop; end;