home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
PARASOL
/
VIDEOSTO.ARK
/
MAIL-LBL.LIB
< prev
next >
Wrap
Text File
|
1986-10-03
|
13KB
|
508 lines
{-------------------------------------------------------------------
record inqlabel;
byte inqlabel.num.wide value "4";
field inqlabel.data.width 2 value "40";
field inqlabel.chars.between 2 value "5";
field inqlabel.label.lines 2 value "6";
byte inqlabel.life.annual value " ";
field inqlabel.month.joined 2 value " ";
field inqlabel.year.joined 2 value " ";
endrec;
redefine screen.data;
record sc.inqlabel;
string ##inqlabel;
endrec;
endredef;
byte data.this.line value "N";
word pointer lbl.wp;
byte lbl.cnt;
byte num.labels;
byte label.data.width;
byte label.chars.between;
byte label.lines;
byte lbl.line.ctr;
record label.data;
record label.1;
field label.name 50;
field label.addr 50;
field label.city 50;
field label.zip 10;
endrec;
string (##label.1 * 3); {--max 4-wide labels--}
endrec;
record label.m.keys;
word label.m.key;
string 30;
endrec;
byte disk.out.open value "N";
byte disk.out.byte;
string disk.out.buff 128;
file disk.out,
disk, text,
record disk.out.byte,
buffer disk.out.buff,
value "LABEL.OUT";
{-------------------------------------------------------------------
byte pointer pri.bp;
procedure put.report.item:
begin
if inqlabel.num.wide = "D" then
if disk.out.open <> "Y" then
open disk.out output remove error standard;
move "Y" to disk.out.open;
fi;
if data.this.line = "Y" then
move "," to disk.out.byte; write disk.out;
fi;
while wk.str[byte] = " " do
move wk.str[+1] to wk.str;
od;
move #wk.str to wk.bp;
move '"' to disk.out.byte; write disk.out;
while @wk.bp <> 0 do
move @wk.bp to disk.out.byte; write disk.out;
add 1 to wk.bp;
od;
move '"' to disk.out.byte; write disk.out;
else
subtract #report.line from pri.bp giving wk.word;
move #wk.str to wk.bp;
while wk.word < report.width
and @wk.bp <> 0 do
move @wk.bp to @pri.bp;
add 1 to pri.bp;
add 1 to wk.bp;
add 1 to wk.word;
od;
fi;
move 'Y' to data.this.line;
end;
{-------------------------------------------------------------------
procedure init.report.line:
begin
move 'N' to data.this.line;
move #report.line to pri.bp;
fill report.line with ' ';
end;
{-------------------------------------------------------------------
procedure label.print.mask:
begin
if inqlabel.num.wide <> "D" then
move 0 to lbl.line.ctr;
call init.report.line;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
fill wk.str with ".";
move "Name" to wk.str length 4;
add #wk.str to label.data.width giving wk.bp;
move 0 to @wk.bp;
call label.put.item;
od until lbl.cnt >= num.labels;
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
fill wk.str with ".";
move "Address" to wk.str length 7;
add #wk.str to label.data.width giving wk.bp;
move 0 to @wk.bp;
call label.put.item;
od until lbl.cnt >= num.labels;
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
fill wk.str with ".";
move "City, State" to wk.str length 11;
add #wk.str to label.data.width giving wk.bp;
move 0 to @wk.bp;
call label.put.item;
od until lbl.cnt >= num.labels;
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
fill wk.str with ".";
add #wk.str to label.data.width giving wk.bp;
move 0 to @wk.bp;
subtract 5 from wk.bp;
move "*Zip*" to @wk.bp[sp] length 5;
call label.put.item;
od until lbl.cnt >= num.labels;
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
move label.lines to lbl.cnt;
subtract lbl.line.ctr from lbl.cnt;
while lbl.cnt <> 0 do
call print.report.line;
subtract 1 from lbl.cnt;
od;
fi;
end;
{-------------------------------------------------------------------
procedure get.label.member:
begin
if @lbl.wp <> m.key then
move @lbl.wp to m.key;
read member error standard;
call justify.member.fields;
fi;
end;
{-------------------------------------------------------------------
procedure space.to.next.label:
begin
if inqlabel.num.wide <> "D"
and lbl.cnt < num.labels then
fill wk.str with " ";
add #wk.str to label.chars.between giving wk.bp;
move 0 to @wk.bp;
call put.report.item;
fi;
end;
{-------------------------------------------------------------------
procedure label.put.item:
begin
if inqlabel.num.wide <> "D" then
do
size wk.str giving wk.byte;
if wk.byte >= label.data.width then
exitdo;
fi;
append " " to wk.str;
od;
add #wk.str to label.data.width giving wk.bp;
move 0 to @wk.bp;
else
call trunc.wk.str;
fi;
call put.report.item;
call space.to.next.label;
end;
{-------------------------------------------------------------------
procedure build.city.state.zip:
begin
move m.city to wk.str;
call trunc.wk.str;
scan wk.str for "~ff~" giving address wk.bp; {-ptr to null byte-}
subtract 1 from wk.bp;
if @wk.bp = "," then
append " " to wk.str;
else
append ", " to wk.str;
fi;
move m.state to wk.str.2;
append wk.str.2 to wk.str;
call trunc.wk.str;
if label.lines < 5 then
append " " to wk.str;
move m.zip to wk.str.2;
append wk.str.2 to wk.str;
fi;
call trunc.wk.str;
end;
{-------------------------------------------------------------------
procedure skip.label.item:
begin
if inqlabel.num.wide <> "D" then
fill wk.str with " ";
add #wk.str to label.data.width giving wk.bp;
move 0 to @wk.bp;
else
move "" to wk.str;
fi;
call put.report.item;
call space.to.next.label;
end;
{-------------------------------------------------------------------
procedure put.zip.alone:
begin
if label.lines > 4 then
move m.zip to wk.str;
call trunc.wk.str;
add #wk.str to label.data.width giving wk.bp;
move 0 to @wk.bp;
justify wk.str right length label.data.width;
call put.report.item;
call space.to.next.label;
else
call skip.label.item;
fi;
end;
{-------------------------------------------------------------------
procedure print.all.labels:
begin
move 0 to lbl.line.ctr;
{-----------------
{ Print name
{-----------------
call init.report.line;
move #label.m.keys to lbl.wp;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
if @lbl.wp <> 0 then
call get.label.member;
move m.f.name to wk.str;
call trunc.wk.str;
move " " to wk.str.2[byte];
move m.l.name to wk.str.2[+1];
append wk.str.2 to wk.str;
call trunc.wk.str;
call label.put.item;
fi;
add 2 to lbl.wp;
od until lbl.cnt >= num.labels;
if data.this.line = 'Y'
and inqlabel.num.wide <> "D" then
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
fi;
{-----------------
{ Print address
{-----------------
move #label.m.keys to lbl.wp;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
if @lbl.wp <> 0 then
call get.label.member;
move m.addr to wk.str;
call label.put.item;
fi;
add 2 to lbl.wp;
od until lbl.cnt >= num.labels;
if data.this.line = 'Y'
and inqlabel.num.wide <> "D" then
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
fi;
{-----------------
{ print line 3 (City, State)
{-----------------
move #label.m.keys to lbl.wp;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
if @lbl.wp <> 0 then
call get.label.member;
call build.city.state.zip;
call label.put.item;
fi;
add 2 to lbl.wp;
od until lbl.cnt >= num.labels;
if data.this.line = 'Y'
and inqlabel.num.wide <> "D" then
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
fi;
{-----------------
{ print line 4 (Zip)
{-----------------
move #label.m.keys to lbl.wp;
move 0 to lbl.cnt;
do
add 1 to lbl.cnt;
if @lbl.wp <> 0 then
call get.label.member;
if label.lines > 4 then
call put.zip.alone;
else
call skip.label.item;
fi;
fi;
add 2 to lbl.wp;
od until lbl.cnt >= num.labels;
if data.this.line = 'Y'
and inqlabel.num.wide <> "D" then
call print.report.line;
add 1 to lbl.line.ctr;
call init.report.line;
fi;
{ {-----------------
{ { print line 5 -- (null, or zip)
{ {-----------------
{ move #label.m.keys to lbl.wp;
{ move 0 to lbl.cnt;
{ do
{ add 1 to lbl.cnt;
{ if @lbl.wp <> 0 then
{ call get.label.member;
{ if label.lines > 4 then
{ call put.zip.alone;
{ else
{ call skip.label.item;
{ fi;
{ fi;
{ add 2 to lbl.wp;
{ od until lbl.cnt >= num.labels;
{ if data.this.line = 'Y'
{ and inqlabel.num.wide <> "D" then
{ call print.report.line;
{ add 1 to lbl.line.ctr;
{ call init.report.line;
{ fi;
if inqlabel.num.wide= "D" then
move ^h0d to disk.out.byte; write disk.out;
move ^h0a to disk.out.byte; write disk.out;
move "N" to data.this.line;
else
if lbl.line.ctr <> 0 then
call init.report.line;
move label.lines to lbl.cnt;
subtract lbl.line.ctr from lbl.cnt;
while lbl.cnt <> 0 do
call print.report.line;
subtract 1 from lbl.cnt;
od;
fi; fi;
fill label.m.keys with 0;
end;
{-------------------------------------------------------------------
procedure process.this.member:
begin
word m.key.save;
move #label.m.key to lbl.wp;
move 0 to lbl.cnt;
while @lbl.wp <> 0 do
if @lbl.wp = m.key then
exit;
fi;
add 2 to lbl.wp;
add 1 to lbl.cnt;
od until lbl.cnt >= num.labels;
if lbl.cnt >= num.labels then
move m.key to m.key.save;
call print.all.labels;
move m.key.save to m.key;
fill label.m.keys with 0;
move #label.m.key to lbl.wp;
fi;
move m.key to @lbl.wp;
end;
{-------------------------------------------------------------------
procedure get.label.specs:
begin
move inqlabel to sc.inqlabel;
inqlabel.get.data:
move "inqlabel" to screen.name;
call get.screen.data;
move sc.inqlabel to inqlabel;
if inqlabel.num.wide = "D" then
move 1 to num.labels;
else
subtract "0" from inqlabel.num.wide giving num.labels;
switch on num.labels:
0: goto report.exit;
1 - 4: null;
else begin
move "Number of labels must be between 1 and 4"
to status.line;
call status.line.display;
goto inqlabel.get.data;
end;
endswitch;
fi;
move inqlabel.data.width to wk.str;
convert wk.str to label.data.width;
switch on label.data.width:
10 - 50: null;
else begin
move "Data width must be between 10 and 50"
to status.line;
call status.line.display;
move 1 to get.data.skip.count;
goto inqlabel.get.data;
end;
endswitch;
move inqlabel.chars.between to wk.str;
convert wk.str to label.chars.between;
move inqlabel.label.lines to wk.str;
convert wk.str to label.lines;
switch on label.lines:
4 - 10: null;
else begin
move "Lines per label must be from 4 to 10"
to status.line;
call status.line.display;
move 3 to get.data.skip.count;
goto inqlabel.get.data;
end;
endswitch;
switch on inqlabel.life.annual:
" ","L","A","E": null;
else begin
move "Blank, 'L', 'E', or 'A' only" to status.line;
call status.line.display;
move 4 to get.data.skip.count;
goto inqlabel.get.data;
end;
endswitch;
if inqlabel.month.joined[word] <> " " then
if inqlabel.month.joined[+1,byte] = " " then
move inqlabel.month.joined[byte]
to inqlabel.month.joined[+1,byte];
move "0" to inqlabel.month.joined[byte];
fi;
move inqlabel.month.joined to wk.str;
convert wk.str to wk.byte;
switch on wk.byte:
1 - 12: null;
else begin
move "Blank, or 1-12 only" to status.line;
call status.line.display;
move 5 to get.data.skip.count;
goto inqlabel.get.data;
end;
endswitch;
fi;
if inqlabel.year.joined <> " " then
if inqlabel.year.joined[+1,byte] = " " then
move inqlabel.year.joined[byte]
to inqlabel.year.joined[+1,byte];
move "0" to inqlabel.year.joined[byte];
fi; fi;
move s.label.printer to printer.to.select;
call select.printer;
move 65000 to page.size; {--disable headings--}
move "Y" to end.report.inhibit.form.feed;
call init.report;
move 0 to line.counter; {--disable initial heading--}
if inqlabel.num.wide <> "D" then
do
display "Enter 'Y' for a print-mask";
display "Enter 'R' to reset label-specifications";
accept "Enter 'N' to proceed with label printing: ",wk.str;
switch on wk.str[byte]:
"N","n": exitdo;
"R","r": goto get.label.specs;
"Y","y": begin
call label.print.mask;
call label.print.mask;
display ""; display "";
end;
endswitch;
od;
fi;
end;