22
Fri, Nov
1 New Articles

Creating Barcodes on a Budget

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Brief: You don't need the expense of an IPDS printer to create barcodes on your AS/400. You can use less-expensive, PCL5-capable laser printers like Hewlett- Packard LaserJets and IBM Lexmark LaserPrinters. With the PCL5 printer control language (innate in many PC laser printers) and, in some cases, custom font cartridges, you can create barcodes for less than you might expect.

I had the opportunity to develop a barcode labeling system that included labels for the manufacturing and shipping industry (e.g., raw material, work-in- progress and shipping labels). Prior to the new system, my shop used a third- party, PC-based labeling software package and PC-compatible printers. This package worked with data downloaded to the PC from the AS/400. The PC manipulated it, formatted the label layout and produced the number of labels requested. While it was a workable solution, certain limitations became apparent as the company's labeling requirements changed.

Interpretation of special characters was the main limitation. With the prospect of adding more special characters to the labels, things didn't look very promising. The speed of this application also raised some concerns; it took quite some time for the dedicated PC to generate the labels.

With a good feel for the company's labeling requirements and the limitations of the present system in mind, I started analyzing the options.

The Options

I identified four options for the new labeling system:

1. Use IPDS printers and the DDS BARCODE keyword. 2. Use IPDS printers and Advanced Function Printing Utilities/400. 3. Buy another third-party labeling software package. 4. Develop my own labeling system.

The main requirements for the new system were low cost, quick generation of labels and easy maintenance. The only advantage of the existing third-party labeling software was its use of PC-compatible printers, which are quite inexpensive when compared to IPDS printers. A recent IBM catalog listed an IBM 4039-10R PC printer with PCL5 at $1,599. An IPDS Advanced Function Printing version, IBM 3916-AS1, costs $5,895.

Options one and two were just too expensive for our company. In addition, my previous experience with Advanced Function Printing Utilities/400 was not favorable. When I used Advanced Function Printing Utilities/400 to format material safety data sheets, it added a considerable amount of time to the overall process.

My company operates several plants and warehouses, and every one of them must have a dedicated PC for the label application using the third-party software. Implementation of a new labeling requirement entails installing the new copy of the label layout at every site. Talk about a logistics nightmare-the company's sites span several states. This eliminated option 3.

That left me with the option to develop my own labeling system. Other programmers in my department had already developed some custom forms, using a PC printer control language called PCL5. Most of their experience with PCL5 had been fruitful, and the language appeared to contain all of the features I required. I borrowed a PCL5 Printer Language Technical Reference Manual (Hewlett-Packard part number 5961-0509) and started on my quest. (The technical reference manual for IBM Lexmark LaserPrinters also contains a small section concerning PCL5 emulation.)

My investigations revealed that the only features not built into PCL5 were the actual barcodes or special fonts that I might need. Most laser printers come with several bitmapped and scalable fonts already loaded for easy access. If you need barcodes or special fonts, you can purchase them in the form of cards that slide into the printer. Company logos, signatures and even macros for special forms can be placed on these cards.

My initial application was developed using a Hewlett-Packard LaserJet III with the HP LaserJet Bar Codes & More font cartridge (part number C2053a #C06), available through Hewlett-Packard or an authorized dealer.

Eventually, I decided to use the IBM Lexmark LaserPrinter because of its ability to handle heavy stock. The printer had a PCL5 emulation card installed for labels. No off-the-shelf font cartridge for the Lexmark supported the barcodes and special characters I would need, so I approached a company that could customize a card to meet my requirements. Architext, Inc. developed a cartridge for me that contained a Code 3-of-9 barcode, a trademark symbol, a registered symbol and a Childress 50-point font.

The Software

They say it's best to tackle the worst first. The project which promised to be most challenging was the automotive industry standard level (AIAG) label, which contained several boxes with barcodes inside them. (See 1.) To construct the label, I used PCL5, an RPG program and a printer file created with DDS. To compose the AIAG label in 1, I needed to print more than just the barcode. I printed the following items in the sequence shown:

They say it's best to tackle the worst first. The project which promised to be most challenging was the automotive industry standard level (AIAG) label, which contained several boxes with barcodes inside them. (See Figure 1.) To construct the label, I used PCL5, an RPG program and a printer file created with DDS. To compose the AIAG label in Figure 1, I needed to print more than just the barcode. I printed the following items in the sequence shown:

o The boxes. o The part number. o The part number barcode. o The lot number. o The background shading for the lot sequence.

The RPG shown in 2 is a fragment of the program I used to create the label-it only creates the part number barcode. It is meant to give you an idea of what using PCL5 is like. This is a very simple program created just for this article and does not demonstrate the full potential of PCL5. All the variables in this particular label are alphanumeric, but they can be numeric variables with edit codes.

The RPG shown in Figure 2 is a fragment of the program I used to create the label-it only creates the part number barcode. It is meant to give you an idea of what using PCL5 is like. This is a very simple program created just for this article and does not demonstrate the full potential of PCL5. All the variables in this particular label are alphanumeric, but they can be numeric variables with edit codes.

The barcode formatting consists of an asterisk (*) at the beginning, followed by the variable and another asterisk at the end. See the highlighted section in 2.

The barcode formatting consists of an asterisk (*) at the beginning, followed by the variable and another asterisk at the end. See the highlighted section in Figure 2.

The AIAG DDS specs in 3 have several of the basic PCL5 command groups hard-coded as literals. They are all preceded by a logical not symbol (), used to represent an ASCII escape character. In my configuration, this is accomplished by using a printer function table in a PC Support printer session. (I will cover this in more detail later, along with possible hardware configurations.) Instead of hard-coding the PCL5 commands in the DDS, all of the PCL5 commands could have been formatted in the RPG program in a variable field and passed to the printer file.

The AIAG DDS specs in Figure 3 have several of the basic PCL5 command groups hard-coded as literals. They are all preceded by a logical not symbol (), used to represent an ASCII escape character. In my configuration, this is accomplished by using a printer function table in a PC Support printer session. (I will cover this in more detail later, along with possible hardware configurations.) Instead of hard-coding the PCL5 commands in the DDS, all of the PCL5 commands could have been formatted in the RPG program in a variable field and passed to the printer file.

The following are explanations of some of the important PCL5 commands which I have embedded into the external printer file shown in 3.

The following are explanations of some of the important PCL5 commands which I have embedded into the external printer file shown in Figure 3.

1. Job Control: This is seen in the Reset statement (label A) and is used to reset the printer and prepare it for further instructions. Other examples: Number of copies, Output bin selection.

2. Page Control: The Paper size (label B) and Landscape printing (label C) statements are examples of this command group. Other example: Paper source selection.

3. Barcode and Font Selection: The Select font statement (label D) falls within this command group. The fonts that are available, whether they are resident or on a font card, pretty much determine your choices.

When creating the printer file, you should be aware that the values you submit with the LPI (lines per inch) and OVRFLW (overflow line) keywords may need adjustment, depending on how complicated your form or label is. 4 contains the actual output sent to the printer for the AIAG label.

When creating the printer file, you should be aware that the values you submit with the LPI (lines per inch) and OVRFLW (overflow line) keywords may need adjustment, depending on how complicated your form or label is. Figure 4 contains the actual output sent to the printer for the AIAG label.

If the line spacing [SPACEA(xxx)] is not set properly, the DDS is almost impossible to debug because of overwriting. The trick is to display the spool file, see if there is any overwriting and correct the line spacing.

The Hardware and PC Support

All of the printers I used (Hewlett-Packard and IBM) are attached to a personal computer on a token-ring network using PC Support for the AS/400 printer emulation. You must change the EBCDIC-to-ASCII table for your PC Support printer session to convert the logical not () into the ASCII escape character of hex(1B). You can convert other characters, such as trademark symbols, in the same manner. (See the PC Support/400 Installation and Administration Guide for DOS or OS/2 for information on changing printer-session options.)

PCL5 printers can also be connected to some twinax workstations with ASCII printer ports and through some emulation boards. But, as with PC Support printer sessions, the EBCDIC-to-ASCII translation tables used by the workstation or emulation board must be modified. For twinax workstations, refer to Appendix B of IBM's AS/400 Workstation Customization Function Programmer's Guide. It provides more information on hooking up an ASCII printer to a twinax display. For emulation boards, refer to the emulation board manufacturer's manual.

Depending upon the printer, you may find that the cards which support extra fonts or special characters are available off-the-shelf. Otherwise, a firm such as Architext, Inc. can develop the card for you. The trick to developing a custom card is to incorporate all of the necessary fonts and special characters in one card and then have it duplicated. It is considerably less expensive to copy the original than to keep creating new cards.

Although I have not run across this problem so far, you should be aware that the printer may not have enough internal memory to process all of the commands. However, most PCL5-compatible printers can receive memory upgrades.

Enhancements

One enhancement I made to this labeling project deserves mention. My company needs an offline manual system for finished goods labels, for times when the AS/400 is incapacitated. At night, we run an AS/400 program to create one finished-goods label for every open shop order, but we omit the escape character () in all commands. This data is then downloaded to a PC and converted into a format that FoxPro can use.

A FoxPro program prints the label lines and inserts the ASCII escape character, CHR(27), before each command. If the AS/400 becomes unavailable, the FoxPro program can produce a label that looks as if it were generated by the AS/400.

The Bottom Line

Last but not least is the financial aspect of this approach to barcoding. The cost to create the first custom card for the IBM Lexmark printers-with the trademark symbol, the registered symbol, the Code 3-of-9 barcode and the special font-was $350. Copies of this card cost me $125 each. I needed one original and eight copies, for a total of $1,350.

My old printers were targeted for replacement because of rising maintenance costs, and the ASCII printers are much less expensive than IPDS printers. The fact that I did not need third-party labeling software or IBM's Advanced Function Printing Utilities/400 also helped to keep costs down.

Programming changes for five different types of labels took about three to four weeks to complete.

If you own a PCL5-capable printer (e.g., HP LaserJet or IBM Lexmark), the technology for barcodes, special characters and even certain graphic elements such as boxes and shading is already available. All you have to do is use it. Richard Romanek is a senior programmer/analyst and has been actively involved in the midrange computer industry since 1988.

REFERENCES

AS/400 Workstation Customization Function Programmer's Guide (SC41-0056, CD-ROM QBKA3A01). PC Support/400: DOS Installation and Administration Guide (SC41-0006, CD-ROM QBKA6302). PC Support/400: OS/2 Installation and Administration Guide (SC41-0007, CD-ROM QBKA6802).

VENDOR SOURCE Architext, Inc., 121 Interpark Blvd., Suite 208, San Antonio, TX 78216-1808. Voice: 210-490-2240; fax: 210-490-2242.


Creating Barcodes on a Budget

Figure 1 AIAG Label Created on a PCL5 Printer

 UNABLE TO REPRODUCE GRAPHIC 
Creating Barcodes on a Budget

Figure 2 LABAIAG RPG Program

 ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 H************************* H* AIAG LABEL USING PCL5 * H************************* FLABAIAGOO E PRINTER C* ENTRY PARAMETERS C *ENTRY PLIST C PARM PART# 15 PART NO. C* PART NO. C MOVELPART# PARTN1 C* PART NO. - BARCODE FORMAT C MOVE *BLANK WRK17A 17 C MOVEL'*' WRK17A C CAT PARTN1:0 WRK17A C CAT '*':0 WRK17A C MOVELWRK17A PART1A C* PRINT LABEL C WRITELABELA1 C* C MOVE '1' *INLR ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
Creating Barcodes on a Budget

Figure 3 LABAIAGO DDS Specifications

 ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 A******************** A* LABEL LAYOUT * A******************** A R LABELA1 A SKIPB(001) A* RESET A 1'E' A SPACEA(001) A* SIZE A 1'&l2A' A* LANDSCAPE A +1'&l1O' A SPACEA(001) A******************* A* PART NUMBER * A******************* A* SELECT FONT A 1'(8U(s1p12.00v0s0b4101T' A* POSITION CURSOR A +1'*p350x250Y' A* A +1'PART NO.:' A* POSITION CURSOR A +1'*p350x290Y' A* A +1'(P)' A SPACEA(001) A* SELECT FONT A 1'(8U(s1p24.00v0s3b4148T' A* POSITION CURSOR A +1'*p600x310Y' A* PART NUMBER A PARTN1 15A +1 A SPACEA(001) A******************** A* BAR CODES * A******************** A* SELECT BAR CODE A 1'(0Y(s0p4.69h12.0v0s0b0T' A SPACEA(001) A************************** A* PART NO BAR CODES * A************************** A* POSITION CURSOR A 1'*p400x400Y' A* PART NO. BAR CODE 1 A PART1A 17A +0 A SPACEA(001) ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 
Creating Barcodes on a Budget

Figure 4 LABAIAG Output

 E &l2A &l1O (8U(s1p12.00v0s0b4101T *p350x250Y PART NO.: *p350x290Y (P) (8U(s1p24.00v0s3b4148T *p600x310Y 103478 (0Y(s0p4.69h12.0v0s0b0T *p400x400Y*103478* 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: