| You didn't indicate whether the bar code application needed to run
from a Vax, so I'll put this info here for you anyway. Below are
notes extracted from my DBASE notes file (ASGMKA::DBASE). I hope
this helps.
Joe Tomas
<<< DISK07:[NOTES$LIBRARY]DBASE.NOTE;1 >>>
-< *** dBASE II/III *** >-
================================================================================
Note 112.0 Code39 Bar Code Labels /dBASE 1 reply
ASGMKD::TOMAS 39 lines 10-JAN-1986 13:11
--------------------------------------------------------------------------------
About a year ago I wrote a dBASE II application that would print CODE39 bar
code labels on the LA50 printer. Since then, several people have asked for
a copy of the program. If anyone has a desire for the program, let me know
and I'll make it available.
-Joe-
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
PROGRAM DESCRIPTION:
dBASE II version -
BCODE.PRG was written for a specific project and is designed to print only
3 character (0-9, A-Z) labels, although it may be modified to accept up to
4 characters. The reason for this limitation is that all data is stored
in 27 character memory variables and any more than 4 characters times 27
exceeds dBASE II's memory variable limitation of 128 characters.
You are also asked whether you want large or small (default) labels. Some
bar code scanners may have difficulty reading the small resolution labels,
so if you request large, the program goes out to another PRG file to reload
the memory variables with the proper data.
Yes, the program is somewhat crude and certainly can be improved upon. Please
be my guest.
dBASE III version -
This version has the data for large and small aspects stored in two DBF files,
both with the same index file. Because dBASE III allows up to 255 characters
for variable names, the label can now print up to 9 alphanumeric characters
(still limited to 0-9, A-Z). Again, with some modifications, I'm certain
that even this limitation can be overcome.
ENJOY!
================================================================================
Note 112.1 Code39 Bar Code Labels /dBASE 1 of 1
ASGMKD::TOMAS 27 lines 13-JAN-1986 10:30
--------------------------------------------------------------------------------
OK...OK. I should have known better that someone would ask for them.
The files are now available in my public account as follows:
The dBASE II version (either CP/M or MS-DOS) is at:
ASGMKD::DUA0:[TOMAS.PUBLIC.CPM] BCODE.PRG
TABLE3_1.PRG <- 3:1 aspect ratio
The dBASE III version is in:
ASGMKD::DUA0:[TOMAS.PUBLIC.MSDOS] BCODE.PRG
CODE39S.DBF <- data file for 2.5:1 aspect
CODE39L.DBF <- data file for 3:1 aspect
CHAR.NDX <- index file for both .DBFs
These files were uploaded using LCTerm (Kermit protocol), so be sure to set
the SEND PACKET_LENGTH 90 and SET FIL TY BIN on the VAX end if you're down-
loading the DBF and NDX files. The PRG files are ASCII files.
Enjoy.
-Joe-
|
| Well, I can't figure out COBOL, nor how to pass parameters to BAR.COB,
so I threw together this command file. Thanks to Bluejay Adametz for
the required bit patterns.
-piper
$ echo = 'f$verify (0)'
$!++
$! X01.00
$!
$! Bar codes. In DCL? Sure, why not...
$!
$! Output is to SYS$OUTPUT. For files, use @foo/OUTPUT=bar or
$! equivalent. The output is intended for an LA100, but a VT125 or
$! VT240 will do if you ignore the non-wide text output. Looks real
$! nice on an LN03, too.
$!
$! GOSUB is too useful, so this needs VMS V4.4 or later.
$!
$! The array CHAR_SET defines those characters known to CODE39. The
$! corresponding patterns are encoded into the array MASK_SET.
$! MASK_SET is a collection of hex numbers, with wide elements coded as
$! "1" and narrow as "0". Given the wide/narrow order of CODE39, we
$! toggle the bar/space automatically.
$!
$! Thanks to Bluejay Adametz for the bit settings.
$!
$! -piper 2-Jul-1986
$!--
$ esc[0,8] = 27 ! <escape> character
$ sixel_on = esc + "P0q" ! LA100 sixel-on command
$ sixel_off = esc + "\" ! and off command
$
$!++
$! Two bits for a narrow and twice that for a wide seems to work. And
$! this width goes nicely with 5 char/inch text.
$!--
$ bar = "~~" ! Tilde fires six print heads
$ space = "??" ! Question fires none
$ HEIGHT = 3 ! Do it this many times
$
$ five_per = esc + "[5w" ! Wider text
$ ten_per = esc + "[0w" ! Normal again
$!++
$! Here's the characters CODE39 knows
$!--
$ char_set = "*0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"
$ max_char_index = f$length (char_set) - 1
$!++
$! And an array of integers (using only 9 bits) that define wide (1)
$! and narrow (0) entities. The order of these entities is always
$! bar-space-bar-space-bar-space-bar-space-bar.
$!--
$ mask_set = "094,034,121,061,160," ! *0123
$ mask_set = mask_set + "031,130,070,025,124," ! 45678
$ mask_set = mask_set + "064,109,049,148,019," ! 9ABCD
$ mask_set = mask_set + "118,058,00D,10C,04C," ! EFGHI
$ mask_set = mask_set + "01C,103,043,142,013," ! JKLMN
$ mask_set = mask_set + "112,052,007,106,046," ! OPQRS
$ mask_set = mask_set + "016,181,0C1,1C0,091," ! TUVWX
$ mask_set = mask_set + "190,0D0,085,184,0C4," ! YZ-.<space>
$ mask_set = mask_set + "0A8,0A2,08A,02A" ! $/+%
$
$ 10:
$ read /end=99 sys$command string /prompt="Input string: "
$
$ gosub generate_code ! Do some real work
$ if .not. $status then goto 10 ! Quietly do nothing
$
$ gosub write_it_out ! Write some bytes out
$
$ goto 10
$ 99:
$ exit 1 + 0*f$verify(echo)
$ generate_code:
$!++
$! Change those characters into strings of Sixel stuff. The output
$! is in the "array" CODE(i).
$!--
$ string = f$edit (string, "upcase,trim") ! Tweak it
$ string = "*" + string + "*" ! Pad the ends with stars
$ position = 0 ! Init this pointer
$ length = f$length (string) ! How long is this
$
$ code = "" ! Start the output rolling
$ gc_10:
$ char = f$extract (position, 1, string) ! Grab a character
$ index = f$locate (char, char_set) ! Where in the set?
$ index = f$integer (index) ! Number, please
$ if index .gt. max_char_index then - ! OK?
return %x10000000 ! No, barf
$
$ mask = f$element (index, ",", mask_set) ! What hex digits?
$ mask = "%x" + mask ! Make it hex
$ mask = f$integer (mask) ! Then an integer
$!++
$! OK, we have the mask for this character. Now play bar-space-bar...
$! on it. Each time the mask has a bit set, output a wide {bar|space};
$! bit clear, output narrow.
$!
$! The loop counter (nine iterations, 8..0) serves as the bar/space flag.
$! And we run the loop backwards, since it's easier to IF MASK this way.
$!--
$ n = 8
$ this_code = ""
$!++
$! Add an inter-character gap, two spaces wide, but not on the front
$!--
$ if code .nes. "" then code = code + space + space
$
$ gc_20:
$ thing = bar ! Assume a bar
$ if n then thing = space ! Or a space
$ if mask then thing = thing + thing ! Two of 'em for wide
$ this_code = thing + this_code ! Add it on the left
$ mask = mask / 2 ! Shift right
$ n = n - 1 ! Count down
$ if n .ge. 0 then goto gc_20 ! Loop
$
$ code'position' = this_code ! Store in 'array'
$
$ position = position + 1 ! Next character
$ if position .lt. length then goto gc_10 ! Loop, maybe
$ return ! Finished
$ write_it_out:
$!++
$! OK, we've got an array CODE(i), i=0,length (or so). Write out this
$! thing HEIGHT times (six bits high per go-around).
$!--
$ write sys$output sixel_on ! Into graphics
$ w_i = 0 ! Height loop
$ w_10:
$ w_p = 0 ! Character-code loop
$ w_20:
$ write sys$output code'w_p' ! One character
$ write sys$output space, space ! Inter-char gap
$ w_p = w_p + 1
$ if w_p .lt. length then goto w_20
$
$ write sys$output "-" ! Graphics newline
$
$ w_i = w_i + 1 ! Bump height count
$ if w_i .lt. HEIGHT then goto w_10 ! However many times
$
$ write sys$output f$fao ("!AS!/!AS!AS!AS!/", -
sixel_off, - ! Kill graphics
five_per, - ! Wider text
string, - ! For this string
ten_per ) ! Back to normal text
$
$ return ! All done
|