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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sco Unix & Cobol - Print Barcodes 2

Status
Not open for further replies.

ebmaust

Programmer
Mar 20, 1999
1
AU
In windows I print a number using a barcode font. How do you do this from Cobol under Unix?<br>

 
Hi ebmaust,
One method requires that you know the control characters for the printer being used to print the barcodes. For example, if the printer is an OKIDATA 4410 and you wanted to print Interleave 2 of 5 barcodes, you would do the following:

First define the print command to select the type and size of the barcode:

* N0 = designates the number of characters to follow
* N1 = selects Interleaved 2 of 5
* N2 thru 8 defines the physical size of the barcode
*
******************************************************************

Code:
       01  select-code.
           05 filler           pic 9  comp-x value 27.
           05 filler           pic 9  comp-x value 16.
           05 filler           pic x  value &quot;A&quot;.
           05  n0              PIC 9 comp-x value 8.
           05  n1              PIC 9 comp-x value 3.
           05  n2              PIC 9 comp-x value 0.
           05  n3              PIC 9 comp-x value 0.
           05  n4              PIC 9 comp-x value 3.
           05  n5              PIC 9 comp-x value 0.
           05  n6              PIC 9 comp-x value 0.
           05  n7              PIC 9 comp-x value 0.
           05  n8              PIC 9 comp-x value 0.
We used comp-x since we want to send the binary equivalent of the values to the printer. 27 16 is Escape DLE.
Second define the command to print the barcode.

Code:
       01  bar-code.
           05  filler          pic 9  comp-x value 27.
           05  filler          pic 9  comp-x value 16.
           05  filler          pic x  value &quot;B&quot;.
           05  no-of-chars     pic 9  comp-x value 8.
           05  bar-code-chars  pic x(9) value &quot;12345678&quot;.
Now send the commands to the printer:

write print-record from select-code.
write print-record from bar-code.

The above would print a barcode for the characters 12345678.

You can probably obtain the printer commands from the printer manufacturer's web site.
Let me know if you need more information
Mike Marley



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top