Blog

A Stored Procedure Helper in .Net C#

A Stored Procedure Helper in .Net C#

I wrote this helper to make calling SQL stored procedures easier and less error prone. The idea here is to encapsulate the parameters of the stored procedure in an interface method that gets implemented for each stored procedure. The values of the input parameters are encapsulated in an object. It makes use of Microsoft’s (now defunct) Enterprise Library DAAB (https://learn.microsoft.com/en-us/archive/msdn-magazine/2005/august/the-enterprise-library-data-access-application-block-part-2). Here’s the interface definition: Here’s the definition of a class named “LoginParameters” that implements the interface “IPrepareSpParameterValues”. It encapsulates the…

Read More Read More

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

It’s Friday and there’s 17 new JS frameworks out there

It’s Friday and there’s 17 new JS frameworks out there

If you’re like me you’re tired of hearing that there’s a new JavaScript framework for client-side web development that’s better than everything that ever came before it. It seems that once you have decided on a framework and think to yourself “Ok, it has some things I don’t like but I’m going with Angular”, or “React”, or “ZenPoopula”, or whatever, a newer framework is announced that looks promising. You bite your lip and vow not to look at it; you’ve…

Read More Read More

*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.