Print Barcode

Last Revised: 07/08/14

This routine is called to print bar codes on PCL compatible printers.  It supports Code 3 of 9, EAN (8 or 13 digits), UPC (6 or 12 digits), and Intelligent Mail Barcodes.

Also see CDS264 for printing Postnet Barcodes.

Calling Format:

CALL "CDS654", ERR=XXXX, Y6$, S654$, TXT$ {,ZIP$}

CDS654 Arguments
Argument Passed To/From Description
ERR=XXXX N/A Error branch taken if:
  • Y6$ is not provided
  • Printer is not PCL compatible
  • S654$ not templated
  • S654.TYPE$ is not valid
  • for Intelligent Mail Barcodes
    • The operating system is not 32 or 64 bit linux
    • TXT$ is not 20 digits long
    • one or more of the segments in TXT$ is invalid
    • ZIP$ is not numeric or 0, 5, 9, or 11 digits

The operator will be prompted unless run from a background task.

Y6$ To Printer Control from Printer Selection routine CDS084
S654$ To
Code Description Length
3 Code 3 of 9 any
E European Article Number (EAN) 8 or 13 numeric digits 8, 13
U UPC (6 or 12 numeric digits) 6, 12
I Intelligent Mail Barcode 31
Y Print text below barcode
COL Dot Column for top left corner of barcode (300 dots/inch)
ROW Dot Row for top left corner of barcode.
HEIGHT Optional height of barcode in dots.  Defaults to 150, or 1/2".
DCNB Optional Dot Columns for Narrow Bar.  Defaults to 2.  Applies to all barcode types except Intelligent Mail Barcodes.
W2NR Optional ratio of Wide to Narrow Bar.  Defaults to 2.  Applies to Code 3 of 9 only.
TXT$ To Data to be encoded.


The standard Code 3 of 9 character set only supports numbers (0-9), Upper Case Letters (A-Z), space, hyphen, dollar sign, slash, plus, and percentage.  However CDS654 support the extended character set that includes all ASCII values from $00$ to $7F$.  Note that most bar code readers need to be configured to interpret the extended character set, otherwise they will return the two character code used to represent those characters not included in the standard character set.
E8 or 13 numeric digits (last digit is the check digit)
U6 or 12 numeric digits (last digit is the check digit)
I20 digit tracking code consisting of
Barcode Identifier2

The Barcode Identifier is typically 00 and is used to define the Optional Endorsement Line (OEL) Description.  Click here for more information.

00Default - No OEL Information
10Carrier Route, Enhanced Carrier Router, and Firm
205-digit Scheme
303-digit Scheme
40Area Distribution Center
50Mixed Area Distribution Center, Origin Mixed
Service Type Identifier3

The Service Type Identifier varies with the Class of Mail and the Address Correction Option.  Click here for more details.

Mailer Identifier6 or 9

The Mailer Identifier is a number assigned to the mailer by the Post Office.  The Mailer Identifier can be maintained using Company Information Maintenance (SMC) and can be retrieved using SW005 and referenced as DD00.MAILERID$.

Serial Number9 or 6

The Serial# is a number assigned by the mailer that can be used to uniquely identify the mail piece.

ZIP$ To For Intelligent Mail Barcode only, ZIP$ can be null, or be a 5 digit zip code, 9 digit zip code (zip+4), or 11 digit zip code (zip+4 followed by delivery point bar code#).

Note that the Intelligent Mail Barcode option is currently only supported on 32 or 64-bit linux systems.  It also requires that java be installed.

2300 TEST:
2310 BEGIN
2320 CALL "CDS041","CDS654",S654$,"YY"
2330 LET S654.ROW=50
2340 CALL "CDS084",Y$,Y5$,U0,S084$,Y6,Y6$
2350 LET S654.TYPE$="3",S654.TEXT$="Y",TXT$="ABC-%.$123",HEAD$="Code 3 of 9"
2360 CALL "CDS254",Y6$,"T0,"+STR(S654.ROW)+",3,,12,,4148",HEAD$
2370 LET S654.ROW=S654.ROW+45
2380 FOR HEIGHT=75 TO 150 STEP 75
2400 FOR COL=0 TO 1200 STEP 1200
2410 LET S654.COL=COL
2420 CALL "CDS654",Y6$,S654$,TXT$,ZIP$
2440 LET S654.ROW=S654.ROW+HEIGHT+60
2450 IF S654.TYPE$="I" THEN LET HEIGHT=150
2470 LET S654.ROW=S654.ROW+60
2480 IF S654.TYPE$="3" THEN LET S654.TYPE$="E",TXT$="00987448",HEAD$="EAN-8"; GOTO 2360
2490 IF S654.TYPE$="E" THEN LET S654.TYPE$="U",TXT$="012345678905",HEAD$="UPC"; GOTO 2360
2500 IF S654.TYPE$="U" THEN LET S654.TYPE$="I",TXT$="00040123456200800001",ZIP$="987654321", HEAD$="Intelligent Mail Barcode"; GOTO 2360
2510 CALL "CDS094",Y6$,"E"
Click here for another example output