.
 News & Views
  The online information source for iSeries and mrc-Productivity Series users
.  January 2004  
Volume 4, Issue 1  
.
. . . . . . . . .
 

Free Automatic Barcode Generation using Barbecue and the mrc-Productivity Series

by Adam Flynn

Sometimes as an mrc application developer, word of your versatile skills can spread, and you'll be asked to do something a little out of the ordinary...such that your first reaction might be "Forget it. It's not possible."

For example: "Our customers need to be able to view and print the barcodes for our products. In a browser. By the end of this week. And I don't want it to cost anything."

Barcode generation packages exist, but they are certainly not free and getting them to integrate with your existing systems can be tricky. However, in the brave new world of open source software there are alternatives and one such solution is Barbecue.

Barbecue is a java-based barcode generator that is simple to use, very configurable and easily integrated with mrc. Best of all, it is absolutely FREE. Visit this link to see an example of mrc and Barbecue working together.

The following are instructions for setting up and using Barbecue with mrc. I'm going to make the assumption that you are already setup to create and run mrc servlet applications. If not, then this isn't the place to start. Instead, visit here for more information.

So how do you get started?

1. Install JDK 1.4
Install the no-cost licensed program 5722JV1 option 6 'Java Developer Kit 1.4 ' on your iSeries. If you are using V5R2 of OS/400 this program should be on your installation disks.

2. Configure Tomcat to run under JDK 1.4.
First, backup /tomcat4112/bin/catalina400.sh. Then edit catalina400.sh and make the following changes (highlighted in bold):

export -s JAVA_HOME=/QIBM/ProdData/Java400/jdk14

CP=$CATALINA_HOME/bin/bootstrap.jar:/QIBM/ProdData/Java400/jdk14/lib/tools.jar

java -ms64m -Duser.dir="$CATALINA_BASE" -Dcatalina.base="$CATALINA_BASE"
-Djava.version=1.4 -Djava.awt.headless=true -Dcatalina.home="$CATALINA_HOME" org.apache.catalina.startup.Bootstrap "$@" start

3. Configure Apache to serve Barbecue content
Add the following directive to the httpd.conf file of your Apache webserver immediately after the other JkMount directives, then restart the server:

JkMount /barbecue-1.0.6/* ajp13

4. Download and Install Barbecue.
Visit the following URL and click the Download link (or it may download automatically).

http://prdownloads.sourceforge.net/barbecue/barbecue-1.0.6.zip?download

5. Once you have this file on your PC, unzip it using WinZip or Pkzip to expand the directory structure. In the top-level directory there will be a file called barbecue-1.0.6.war. Copy this file and drop it into the following directory in the IFS:

/tomcat4112/webapps

6. Restart Tomcat and the war file will automatically expand and deploy. To test it, visit the following URL in your browser (where xxx.xxx.xxx.xxx is the IP address or hostname of your iSeries):

http://xxx.xxx.xxx.xxx:8080/barbecue-1.0.6/barcode?data=123545&height=50

7. Create a simple servlet using mrc.
Create a simple multiple record inquiry servlet. For the purposes of the example I created a file with 2 fields, Product Number and Barcode and created a servlet inquiry over it.

8. Edit the html skeleton of the servlet you created to include Barcodes
Edit the html skeleton of the servlet you created in step 7 and changed the following line from...

<TD NOWRAP class="class_name" ALIGN="LEFT">F_V_TN_ZBARCO</TD>

...to...

<TD NOWRAP class="class_name" ALIGN="LEFT"><img src="/barbecue-1.0.6/barcode?data=F_V_TN_ZBARCO&height=50"></TD>

It's as simple as that. Barbecue has many more options that you can configure to adjust the appearance of the barcode. More information can be found within the docs directory of the unzipped Barbecue directory structure you created above.

The next time you are asked to do something out of the ordinary, remember that the open source movement is a great resource for unusual applications. Better still, give us a call and see if we can help.


.
. Quick Links...

Visit mrc's Web site

See a live demo

Get more information

View Latest Newsletter

Last Month's Newsletter

.
.
.
.
. Contact mrc...

U.S. Offices
mrc@mrc-productivity.com

voice: 630-916-0662

www.mrc-productivity.com



U.K. Offices
michaels, ross & cole (UK) ltd

voice (UK): +44 (0)20 8282 1600

mail@mrcuk.com


.
 mrc publishes this newsletter on a monthly basis. Subscription is free of charge. Please send any questions or comments about this newsletter to news@mrc-productivity.com. This newsletter is edited by Heather Gately.

To unsubscribe, please just reply to this e-mail with Unsubscribe in the subject line.
View our privacy promise.

.