Re: Barcodes and Informix
Posted in 1994
In article <ywJBLc5w165w@cssnet.sanford.nc.us>, J. David Schronce <david@cssnet.sanford.nc.us> wrote: >I'd like to be able to generate BarCodes for my picking tickets and >shipping documents. Has anyone had any succcess creating these from >Informix? > >Hints, and instructions HIGHLY appreciated! > >---dave--- > >david@cssnet.sanford.nc.us [J. David Schronce] >Computer Support Services - Public Access Usenet - 919/708-5066 I purchased "Bar Code Library" from StrandWare (800) 552-2331. Installed their "C" source code and wrote 4gl access functions. If you decide to go this route E-mail me and I send you the 4gl access functions. We are using this to generate bar codes on HP Lasers. When linked into 4gl programs would look like the following: { Informix 4gl Bar Code test program define BarReturnString char(1000), # printer control commands BarReturnLength integer, # ^ the declared length of this string BarType integer, # number that identifies the bar code BarToMake char(20), # generate bar code for this text TextToPrint char(20), # printed under bar code PrinterType integer, # number that identifies the printer LeftMarOffset integer, # #char to indent (0 relative addr. on laser) BarHeight integer, # bar code heigth in 1/10 inches CheckSum integer, # 1 - enable 0 - disable where applicable NbrPasses integer, # overstrike print passes (ignored for laser) BarLength integer # >0 size of string to send to printer # <0 errors # -1 BarType not between 1 and 14 # -2 length of BarToMake =0 or >30 # -3 TextToPrint >30 # -4 PrinterType > then # defined printers # -5 LeftMarOffset > 250 # -6 BarHeight >20 (2") or <1 # -7 CheckSum >2 # -8 NbrPasses not between 1 and 5 # -9 Bar code generation error # # -100 4gl error Buffer overflow let BarToMake = "0123456" let TextToPrint = "Num0123456" let BarType = 8 # Code 128 let PrinterType = 4 # laser jet 300dpi let LeftMarOffset = 0 # 0 margin let BarHeight = 4 # .4 inches let CheckSum = 0 # no checksum let NbrPasses = 0 # 0 for laser let BarReturnLength = 1000 # tell routine how much space we have call BarCode4gl(BarReturnLength, BarType, BarToMake, TextToPrint, PrinterType, LeftMarOffset, BarHeight, CheckSum, NbrPasses) returning BarLength, BarReturnString PRINTER TYPES BARCODE TYPES (0) PostScript (1) UPC-A (1) Epson - 9 pin (2) UPC-E (2) IBM Proprinter - 9 pin (3) EAN/JAN-13 (3) HP Laserjet - 150 dpi (4) EAN/JAN-8 (4) HP Laserjet - 300 dpi (5) 3 of 9 (5) Epson 24 pin mode (6) Extended 3 of 9 (6) Toshiba (7) Interleaved 2 of 5 (7) Okidata Microline (8) Code 128 (8) IBM Proprinter - 24 pin (9) Codabar (9) Old HP Laserjet - 150 dpi (10) Zip+4 Postnet (10) Old HP Laserjet - 300 dpi (11) MSI Plessi (11) HP Deskjet - 150 dpi (12) Code 93 (12) HP Deskjet - 300 dpi (13) Extended Code 93 (13) HP Paintjet 180 dpi (14) UCC-128 } database patern define prtnum integer, prtcol integer , barstr char(8), baradj integer, retstr char(1000) main start report barrpt to pipe "cat >bar.rpt" let prtcol = 1 for prtnum = 8350 to 8399 output to report barrpt(prtnum, prtcol, 2) let prtcol = prtcol +1 if prtcol > 2 then let prtcol = 1 end if end for finish report barrpt end main report barrpt(bardata, prtcol, numcol) define bardata integer, prtcol integer, numcol integer, batstr char(8), retLen integer, retStr char(1000), colval integer output top margin 0 left margin 3 right margin 4000 order by bardata, prtcol format first page header call BarCode_Dots(3) call BarCode_Cm128Type(3) let colval =0 let baradj =0 print column 1 , today using "mm-dd-yy", " (", time, ")", column 25, "Bar Code Test", column 65, "Page ", pageno using "<<<<<" skip 1 line print column 1, " 10 20 30 40", " 50 60 70 80" print column 1, "----|----.----|----.----|----.----|----.", "----|----.----|----.----|----.----|----." skip 1 line page header print column 1 , today using "mm-dd-yy", " (", time, ")", column 25, "Bar Code Test", column 65, "Page ", pageno using "<<<<<" skip 1 line print column 1, " 10 20 30 40", " 50 60 70 80" print column 1, "----|----.----|----.----|----.----|----.", "----|----.----|----.----|----.----|----." skip 1 line after group of prtcol if prtcol = numcol then print skip 3 lines let colval = 0 let baradj = 0 end if on every row let barstr = bardata using "&&&&&&&&"; call BarCode_Create(1000, 8, barstr, "", 4, 0, 3, 0, 1) returning retLen, retStr if retLen < 0 then print "FATAL BARCODE ERROR ", retLen using "-<<<<<" else print column 9+colval+baradj, " "; print retStr clipped; end if let baradj = baradj + retLen print column 10+colval+baradj, bardata using "########"; let colval = colval+30 end report -- Michael J. Kuhn Consultant phone:410-254-7060 Email: kuhn@rhlab.uunet or uunet!rhlab!kuhn c/o Baltimore Rh Typing Laboratory, Inc. phone:410-225-9595