RPG Evolution and Refactoring - Step 4 of 4 - Setting RPG Slash Free

  • Posted on: 13 September 2009
  • By: NickLitten

Convert it to FREE FORMAT


Of course, I use the Projex4i command to do this step. This is what the MODRPGSRC *FREE command gives us:

   h datfmt(*iso) timfmt(*iso) option(*nodebugio) debug
    // system name:     fix slp06
    // program desc:    fix the records on slp06
    // program no:      ef001
​    // date:            09/09/09 (sadly not at 9:09)
    // author:

   Fefp01l01  if   e           k disk    infsr(*pssr)

   Facsummar  uf   e           k disk    infsr(*pssr)

    // Externally defined file defn's for *LDA and *PSDS
   D lda           e ds                  extname(lda) dtaara(*LDA)

   D pstat         esds                  extname(psds)



      in lda;

      setll l#cono acsummar;
      reade l#cono acsummar;

      dow not %eof(acsummar);

        // get customer order total from work file (efp01) which
        // is generated by accumulating OEP65 invoices

        chain cusn06 efp01l01;

        if %found(efp01l01);
          bodv06 = amount;
          bodv06 = 0;

        update  slr06; // Update Account Balances new Order Total

        reade  l#cono acsummar;


      // --- Program Termination --- 
      out  lda;
      *inlr = *on;

   //standard error handling routine. 
   /include qgpl/qrpglesrc,pssr

Thats the same program in RPG Free Format.

RPG Evolution and Refactoring - Step 3 of 4 - Paroling RPG4

  • Posted on: 12 September 2009
  • By: NickLitten
upgrading RPG program source code

Upgrade RPG4 to use free-friendly code standards

If we were using Rational Developer/i software we could do this automatically. But as a manual process its simple, if a little tedious. Basically when we are going to skim through the code and replace all indicators with the modern and preferred %FOUND BIF technique:

     H debug
      *                                                               *
      *  system name:     fix slp06                                   *
      *                                                               *
      *  program desc:    fix the records on slp06                    *
      *                                                               *
      *  program no:      ef001                                       *
      *                                                               *
      *  date:            09/09/09 (sadly not at 9:09)                *
      *                                                               *
      *  author:                      *
      *                                                               *
     Fefp01l01  if   e           k disk    infsr(*pssr)
     Facsummar  uf   e           k disk    infsr(*pssr)
     D lda           e ds                  extname(lda)

RPG Evolution and Refactoring - Step 2 of 4 - RPG Three becomes Four

  • Posted on: 11 September 2009
  • By: NickLitten



After running MODRPGSRC (Modernize RPG Source) on the old source a new member is created in QRPGLESRC:

* program to fix SLP06 records
FEFP01L01  IF   E           K DISK    INFSR(*PSSR)
D LDA           E DS                  EXTNAME(LDA)
D PSTAT         ESDS                  EXTNAME(PSDS)
C     *DTAARA       DEFINE    *LDA          LDA
C                   IN        LDA
C     K01           KLIST
C                   KFLD                    CUSN06
C     L#CONO        SETLL     ACSUMMAR
C     L#CONO        READE     ACSUMMAR                               06
C                   DOW       *IN06        = *OFF     C     K01           CHAIN     EFP01L01                           02
C                   IF        *IN02        = *OFF
C                   EVAL      BODV06 = AMOUNT
C                   ELSE
C                   EVAL      BODV06 = 0
C                   ENDIF
C                   UPDATE    SLR06
C     L#CONO        READE     ACSUMMAR                               06
C                   ENDDO
C                   EVAL      *INLR = *ON
C                   OUT       LDA
 *  standard error handling routine.
 /Copy qgpl/qrpglesrc,pssr


As you can see the code if more or less the same, with the exception of few elements to make it more readable.

RPG Evolution and Refactoring - Step 1 of 4

  • Posted on: 11 September 2009
  • By: NickLitten

I've recently been writing all my new programs in RPG Free format. Attending RPGWORLD earlier this year, gave me the impetus to finally commit myself to the new and improved style of RPG coding.

I'm currently  in contract at a shop that still has twenty year old programs running in production, the developers still write in RPG3 and shun any development techniques that have been introduced this century. "I havent got time to learn all that newfangled business" is the war cry. "Thats why your code is unreadable, the system runs like a dog, change management is out of control and there are so many bugs" is my silently worded response.

rpg fourAs an RPG programmer I am amazed that other programmers are simply not interested in learning the benefits of the latest generations of RPG. There are lots of flavours and any programmer worth his salt should be proficient in all of them:  RPG2, RPG3, RPG400, RPGILE, RPG4, RPG/Freeformat

I wish IBM had simply named it RPG1-2-3-4-5 but in true befuddling IBM style the Report Program Generators language naming structure is nearly as poor as the naming standards for the System i itself.

Anyway, I digress, my task yesterday was to write a bunch of little utility programs adding up various elements of the JBA System21 Accounts Receivable database to compare values with what was stored in the accounts hierarchy.

For example, "Does the total value of orders actually match all the orders added together?" and "How many invoices and how are outstanding this year by month" relatively simple to write and the first program was already written.

This first program was, quite amazingly,  written in 2008! Some programmers are frozen in the land of the 1980's and refuses to move up from RPG3. The old style code works, dont get me wrong, but can be easily upgraded to a twenty year newer version which is vastly more readable, efficient and easy to maintain - in a few simple steps.

teaching an old dog new tricks - iSeries DEVCON 2009

  • Posted on: 11 September 2009
  • By: NickLitten

I'm like a big kid and really looking forward to the end of October.

But this doesnt involve witches, black cats, badly fitted fancy dress, an orgy of cheap plastic Halloween consumerism not does it involve kids demanding candy under threat of egging your car.

It's the Annual iSeries Developers Convention. October 25th-28, including the jump start day, is four days of computer geek heaven:

The 11th Annual iSeries DevCon is the premier technical event dedicated to iSeries/System i developers and systems managers and it covers all the topics that are critical to being successful including V6R1, RPG, ILE, Java, PHP, WebSphere, XML, HATS and much more. There is no marketing fluff or pie-in-the-sky theory at this event. Our sessions drill down deep into real-world solutions to give you serious, in-depth training you can put to use right away. iSeries DevCon provides the perfect forum for education, peer networking, and collaborative problem solving.


Oooh - I'm getting all perky and excited already.

It works out perfect as this is during an enforced furlough week with my current employer, just going to prove that every cloud has a silver lining...

RPG - a brief history

  • Posted on: 8 September 2009
  • By: NickLitten

So, there I was this morning sipping my cup of rather disgustingly nauseous Pumpkin Flavored Starbucks Coffee - you gotta try these things, because as my grandpa always said "nothing ventured nothing gained" but unfortunately the Judges awarded the beverage Color-7 Presentation-8 Taste-Yuk!... but I digress...

Ah yes, the wonderful RPG programming language.

Discounting my early forays into BASIC in the early 1980's, RPG was the first proper programming language I learnt.

Twenty years later I am still blessed to be working with it and it's evolution is a fun thing which keeps my head in manuals and checking websites to learn new, faster, sharper and shinier ways to write the same style programs I've been doing for two decades now.

I didnt realise that my programming language of choice, RPG, is fifty years old. No wonder the young whipper snappers in the office think I'm a seriously aging hippy programmer  ;)

This fantastic article gives the skinny... warning only serious pointy headed computer geeks need read on...


RPG: A Great Language with a Greater History

Published: August 17, 2009

by Brian Kelly

an Italian school boys confession

  • Posted on: 27 August 2009
  • By: NickLitten

'Bless me Father, for I have sinned.  I have been with a loose girl'

The priest asks, 'Is that you, little Joey Pagano?'

'Yes, Father, it is.'

'And who was the girl you were with?'

'I can't tell you, Father. I don't want to ruin her reputation'

"Well, Joey, I'm sure to find out her name sooner or later so you may as well tell me now. Was it Tina Minetti?'

'I cannot say.'

'Was it Teresa Mazzarelli?'

'I'll never tell.'

'Was it Nina Capelli?'

'I'm sorry, but I cannot name her.'

'Was it Cathy Piriano?'

'My lips are sealed.'

'Was it Rosa DiAngelo, then?'

'Please, Father, I cannot tell you.'

The priest sighs in frustration. 'You're very tight lipped, and I admire that. But you've sinned and have to atone. You cannot be an altar boy now for 4 months. Now you go and behave yourself.'

Joey walks back to his pew, and his friend Franco slides over and whispers, 'What'd you get?'

'Four months vacation and five good leads.'


Evolution of the RPG programmer

  • Posted on: 12 August 2009
  • By: NickLitten

/me remembers back in the late 80's when I was a lad, RPGII was this fantastically exciting thing I learned spending hours and hours and hours reading manuals and staring at these weird HUGE sheets of printed green lined paper with seemingly meaningless code typed on them with dodgy faded dot-matrix printouts.

/me spent many a lunch-hour playing with a huge metal ruler with all kinds of RPG2 column based stuff on it so I could figure out which indicator was where, on the aforementioned dodgy faded dot-matrix printouts.

/me wonders how, two decades later (wow - am I really that old?), this thing called the internet has appeared and yet I still manage to answer questions posted by people that are intelligent enough to find/subscribe and post a question to a forum but are seemingly unable to type the same thing into any of the myriad of search engines - or 'decision engines' if you're a real pointy head, or work at Microsoft.

sexy computers/me wonders how IBM didn’t manage to properly advertise the power of the AS400 (or whatever name it is this week) and this beautiful and elegant RPG language

Dell Poweredge 400sc - Ubuntu, Wubi and a dancing Penguin

  • Posted on: 13 June 2009
  • By: NickLitten

[continued from part1]

Ubuntu Linux: Everyone should try Linux at least once in their lives. If you have an old PC or laptop which just doesnt have the grunt to run Windows anymore - install Linux and give it a fresh lease of life.

If you have a PC or Laptop and use it mainly for surfing the web, checking email along with occasional WORD type document then you have got to be crazy if your not using Linux.

It's FREE! It's Fast. It's Stable. It's Virus Resistant. It has office pre-installed for free. It runs web cams, skype other messengers. It's regularly automatically updated (just like Windows-Update). Did I mention its free?

Ignore any misconceptions you have may have and go and download a copy of the excellent Ubuntu installer from

I really, really, really cant describe how great this Ubuntu installer is.