Browsed by
Category: IBM i

IBM i tips, handy code snippets, and articles

Convert Zebra .GRF Hex to .BMP

Convert Zebra .GRF Hex to .BMP

Recently I needed to print a Zebra-formatted shipping label to a SATO printer. I have another program that transforms ZPL II to SATO but had not implemented graphics because there was no need. Until now. Below is RPGLE source that translates Zebra’s .GRF hex string to a .BMP string that can be used in SATO’s GM command and streamed to the SATO printer for printing. It’s implemented as a stand-alone program but can easily be changed to a procedure for…

Read More Read More

A Simple JSON Generator in RPGLE

A Simple JSON Generator in RPGLE

I wrote this service program to generate JSON from an external data structure. The way to use it is to read a file that has an external data structure associated with it and convert the record into JSON. Below is the service program prototype, implementation, and a sample program that uses the service program. This version supports data types of numeric, character, and boolean. Since DB2/400 doesn’t have a native “bit” type I’ve implemented it in DDS as a 1-byte…

Read More Read More

Break the *PRTF 378 Character Limit with a Custom *WSCST

Break the *PRTF 378 Character Limit with a Custom *WSCST

I had a situation where I was printing a PDF417 barcode to a SATO printer. The data for the barcode contained a name, an address, and other information and together it was longer than 378 characters. 378 is the maximum record length for a printer file. OS/400 printing services will insert a carriage return/linefeed (x’0D’/x’0A’) when 378 is reached. This x’0D’/x’0A’ skewed the PDF417 data. What I needed was a continuous stream of data. Changing the behavior of a printer…

Read More Read More

Get Job Date in RPGLE

Get Job Date in RPGLE

The %date() built-in function, by itself, will return the System date. The following will return the Job date:

*CALLER and System i Stored Procedures

*CALLER and System i Stored Procedures

Activation groups may be the most important concept to understand when creating *PGM and *SRVPGM objects on the System i (AS/400). Get this wrong and you will be chasing your tail for hours trying to figure out why data being returned to you is not what you were expecting.