Tag Archives for " #snippet "

Mar 04

How to read a Data Area (*DTAARA) using IBM i SQL

Our first problem is, SQL doesn’t know what a *DTAARA is. SQL reads data from Tables but our gloriously quirky IBM i Box has other places to secretly store data. Data Areas are just one of these tricky little blocks of data that other machines don’t know about – think of them as a single […]

More Waffle
Dec 05

Cleaning messy IBM i Integrated File System (IFS) file names

This morning I had an email from a blog subscriber ( Hi Rick! ) asking for a code tips on how to cleanup IFS file names to remove erroneous characters and/or malformed directory name slashes. Rather than reply with a plethora of programming options — here is an old, but functional, RPG code snippet that […]

More Waffle
Jun 13

Simple email validation SQL RPG ILE program

There are lots of code snippets, example programs and long waffling discussions in internet land filled with pointy headed AS400, iSeries and IBM i programmer chaps (and chappettes) arguing about the best way to “validate an email address in RPG”. I know because I’ve read nearly all of them, as well as tried all the […]

More Waffle
Feb 27


AKA – writing a new DSPLY opcode that shows more than 52 characters Using the DSPLY opcode to quickly debug a program has long been a staple of us RPG keyboard whackers. The DSPLY operation lets us “display the data in a variable” onto the screen. Everyone uses this quick and dirty technique and everyone […]

More Waffle
Nov 30

Use RPG to find the day of the week

I wanted a handy little RPG code snippet to return the day name for a date. My requirement was to  feed in a date like “Nov 30 2017” and it to tell me that its ‘Thursday’. Google to the rescue, I found a nice little article by RAFAEL VICTORIA-PEREIRA (Thankyou Sir!) which has a code sample […]

More Waffle
Oct 31

Using QSNRTVMOD to find the last displayed screen size

While I was writing that previous blog about handling wide fat screens I stumbled across another useful API (QSNRTVMOD) for retrieving the current screen mode that we are displaying. This means we could find our screen width programmatically. Why isnt that a word? I’m not too sure why anyone would want to do this but… […]

More Waffle
Oct 17

#IBMi Control Language, Templates and Subroutines

Control Language (*CLP) is a wonderful little tool in every IBM i Programmer’s toolkit. Sadly it’s frequently derided, frowned upon and ridiculed by RPG chaps and chappettes. OK, so CL isnt a full suite business language, but reminds me of learning BBC BASIC back in my school days. I secretly wish I could write everything […]

More Waffle
Sep 18

Playing with REXX on IBM i

Wondering what REXX is? First off, it has nothing to do with those big green lizards that ran around angrily eating other lizards (presumably because their pathetically small arms gave them some kind of appendage envy) REXX is a kinda cool interpretive language — a bit like Control language (CLP). The neat thing about it […]

More Waffle
Sep 12

Which %BIF for Chain, Read and other naughty native file IO

rpg chain

I always forget the differences between %EOF, %EQUAL and Not %Found when writing native file I/O in RPG ILE Programs.  Sometimes a file record is %found and sometimes its not. Even after all these years I still scratch my head about which one is which. I know, I know – I should be using SQL right? […]

More Waffle
1 2 3 5