I have a legacy client running V11 chui. They have some code that produces bar codes using an old Progress include file {barcode39.i}.
Recently it was discovered that a . (period) is being read through the code as a - (dash) so they contacted me for some help.
I determined that the variable that holds the binary code equivalent of the characters had the same value for . and for -.
010000101 /* . */
010000101 /* - */
So I figured finding the correct code and replacing it would work. I see that the correct code for . is 100101000 so I replaced that in the code.
The scanner does not read . at all now.
I am hoping someone out here uses the barcode39.i include file and has had better luck with it. If so, can someone/anyone update me on how to fix this issue.
I have attached the barcode.i code for reference.
Thanks so much,
Ross Anderson
nosredna@cogeco.ca
/******************************************************************************/
/* barcode39.i Output a barcode string to be printed */
/******************************************************************************/
/*
Usage:
Define variable input-string as character no-undo initial "001234501".
Define variable bar-code-string as character no-undo.
Run bar-code-39 (input input-string,
input "P030780",
output bar-code-string).
Put control bar-code-string.
*/
/* Create bar-code-stringcode, 39 for HP
**
** The procedure creates ESC-sequences for a bar-code-stringcode in
** Code39 format
** The printer cursor position is restored after printing.
**
** Input: input-string as char no-undo. The char string to translate.
** code-spec as char no-undo. The bar-code spec. see later
**
** Output: bar-code-string as char no-undo. The generated bar-code-stringcode
**
**
** Structure of code-spec:
** 1. P for horizontal bar-code
** L for vertical bar-code
** 2-3 width of small bar-codes and spaces in dots (norm 03)
** 4-5 width of wide bar-code and spaces in dots (norm 07-08)
** 6- Height of bar-code in dots (norm 80)
*/
procedure bar-code-39:
def input parameter input-string as char no-undo.
def input parameter code-spec as char no-undo.
def output parameter bar-code-string as char no-undo.
def var clr as log init true no-undo.
def var wk as char no-undo.
def var drw as char no-undo.
def var dir as char no-undo.
def var kk as char no-undo.
def var att as char no-undo.
def var kod as char no-undo
init "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ.? *$/+%-".
att =
"100100001001100001101100000000110001100110000001110000000100101100100100" +
"001100100000110100100001001001001001101001000000011001100011000001011000" +
"000001101100001100001001100000011100100000011001000011101000010000010011" +
"100010010001010010000000111100000110001000110000010110110000001011000001" +
"111000000010010001110010000011010000010000101110000100011000100010010100" +
"0101010000101000100100010100001010100100001010".
def var ii as int no-undo.
def var jj as int no-undo.
def var ll as int no-undo.
def var brd as int no-undo.
def var jst as int no-undo.
assign ii = if substring (code-spec, 1, 1) = "P" then 1 else 2
bar-code-string = "~E&f0S~E*c100G"
drw = substring ("ab", ii, 1)
+ substring (code-spec, 6)
+ substring ("ba", ii, 1) + "P"
dir = substring ("XY", ii, 1)
kk = "*" + input-string + "*".
do ii = 1 to length (kk):
assign jj = index (kod, substring (kk, ii, 1)) * 9 - 8
wk = substring (att, jj, 9) + "0".
do ll = 1 to 10:
assign brd = if substring(wk,ll,1) = "0" then 2 else 4
bar-code-string = bar-code-string
+ (if clr then "~E*c" + substring (code-spec, brd, 2) + drw
else "~E*p+" + string (integer (substring (code-spec, brd, 2))
+ jst) + dir)
jst = integer (substring (code-spec, brd, 2))
clr = not clr.
end. /* of looping 1 to 10 */
end. /* of going through string 'kk' */
assign bar-code-string = bar-code-string + "~E&f1S"
wk = "".
end.