Printing barcodes on an HP printer

From MidrangeWiki
Jump to: navigation, search

The most portable way (multiple printer vendors) would be to use AFPDS and the DDS keyword BARCODE. This would require setting the printer up as an AS/400 device. Configuring it as a remote output queue will result in the loss of several important features, like page range, restart, error detection, etc.

If you must send the actual print commands to the printer, Pete Hall has published how he accomplished the job at http://www.pbhall.us/ (note the new web site)

27 Jun 2001

Vern Hamberg had this to say 29 Apr 1998 in MIDRANGE-L:

Sending the ESC (x'1B') code causes problems. You can get around this by creating a WSCST (workstation customization object) with a translation table (:EBCASCTBL) section. You need to select one of the characters to represent your ESC code (we use EBCDIC x'9e' or some such). You put the table after the :ASCCPINFO.—:EASCCPINFO. section.

Use RTVWSCST to get the source. You get the same list of manufacturer/model values you get in CRTPRTF. Then insert the table section as stated above. Finally, use CRTWSCST to create a new one. Set mfrmdl in CRT/CHGPRTF to *WSCST and specify your nes WSCST in the WSCST parameter.

Here's the table I'm using.

:EBCASCTBL. :EBCASCTBLE

  EBCDICCP= 37                                              
  ASCIICP= 437                                              
  DATA=                                                     
 /* Code point x'9e' (Æ) changed from x'00' to x'1b' (Æ) */
 /* This will convert Æ to the ASCII escape code         */
 /* -0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F */
   '2020838485A0A68687A49B2E3C282B7C'X      /* 04- */
   '268288898AA18C8B8DE121242A293BAA'X      /* 05- */
   '2D2F838E85A0A68F80A57C2C255F3E3F'X      /* 06- */
   '6F9088898AA18C8B8D603A2340273D22'X      /* 07- */
   'ED616263646566676869AEAF647900F1'X      /* 08- */
   'F86A6B6C6D6E6F707172A6A791001B00'X      /* 09- */
   'E67E737475767778797A7DADA8445900'X      /* 0A- */
   '5E9C9DFA001514ACAB005B5D00DB27DD'X      /* 0B- */
   '7B41424344454647484900939495A2A7'X      /* 0C- */
   '7D4A4B4C4D4E4F50515200968197A398'X      /* 0D- */
   '5CF6535455565758595AFD939995A2DC'X      /* 0E- */
   '3031323334353637383900969A97A300'X.     /* 0F- */
 :EEBCASCTBL.

There's a manual on Workstation Customization, as well as the Printing III & IV redbooks.

We use the ASCII transparent data command ( X'03' ). Put the above code in your RPG output specs and the hex code for the number of characters not to translate followed by the PCL escape sequence. Put this anywhere in your RPG output specs where you need to change fonts, point size, etc. It is a very effective means for controlling an HP laserjet (or any other ASCII printer) from an RPG program. This works with Client Access and TCP/IP printing. A couple of resources:

Midrange Computing magazine Feb/95 has a good article on the transparent data command and the Client Access technical reference manual explains this also.