Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bar coding 1

Status
Not open for further replies.

vracso

IS-IT--Management
Jan 20, 2003
1
MX
does somebody have a code for creating bar code and printing it???
 
Hi:

I'm afraid I'm not understanding your question. I think you're asking for 4GL code to create and print bar codes. What kind of hardware is creating the barcodes? Bar code printers, laser printers?

Communicating with these devices involves sending escape characters to laser printers, and sending formats and other data to bar code printers.

Generally, Informix 4GL won't do this without help. This means writing callable "C" functions. These functions tend to be specific to the hardware you are using.

Regards,

Ed
 
Hi,

The following sample 4GL code prints a barcode for 6 characters at a time; combining the required escape sequences. I have tested this with ordinary dot-matrix printer and it works fine. For Barcode alignment (printing location on paper, barcode width etc.) you may tune the parameters like ^R,^B etc.

For example:
"^R20;0"
"^R76;0"
"^R130;0"
"^B18;1;1;1"
"^B14;0.01;1;1
etc ...

main
define string varchar(50), x char(6), i smallint

start report bcode to "bc"
let string="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
let i=1
while(1)
let x = string[i,i+6]
output to report bcode(x)
let i=i+6
if i>=36 then
exit while
end if
end while
finish report bcode
end main

report bcode(a)
define a char(6)

format
on every row
print ascii(27),
&quot;[<4h&quot;, ascii(13),
&quot;^R20;0&quot;, ascii(13),
&quot;^B14;1;1;1&quot;, ascii(13),
a, ascii(13),
ascii(27),
&quot;[<4l&quot;, ascii(13)
end report

Regards,
Shriyan
 
Thanks for the code.

It does not produce the right results under SCO 3.2.2.4.2 and informix 4.1.

What version of unix informix was it written to be used with and could try to explain the control charaters if possible
 
Hi,

Following is the settings explanations:

^[[<4h^M^R20;0^M^B14;1;1;1^M123456^M^[[<4l^M

ESC[<4h - Enter the barcode/block character
^R - ^R(xrel);(yrel) Relative cursor move
^B - ^B(type);(height);(size);(option)
(type)=style of barcode
1= Code 39
2= Code 39 with check digit added
6= Two of Five with 2:1 Ratio
... etc.
123456 - sample barcode
ESC[<4l - Exit the barcode/block character

^R is not <Ctrl+R> It is ^ + R
^B is not <Ctrl+B> It is ^ + B

This piece of code has been tested under Informix 4GL 7.30.UC1 on HP-UX 10.2 using Mannesmann Tally model MT 645/661.

Regards,
Shriyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top