RPG Evolution, Modernization and Refactoring – Taking RPG4 into the modern code world

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: Nick@nicklitten.com
Fefp01l01 if e k disk infsr(*pssr)
Facsummar uf 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 l#cono setll acsummar
C l#cono reade acsummar
C dow not %eof(acsummar)
C cusn06 chain efp01l01
C if %found(efp01l01)
C eval bodv06 = amount
C else
C eval bodv06 = 0
C endif
C update slr06
C l#cono reade acsummar
C enddo
C eval *inlr = *on
C out lda
* standard error handling routine.
/Copy qgpl/qrpglesrc,pssr

Not that all indicators have been removed and I would also change Z-ADD, MOVE and MOVEL statements into EVAL's. I switch the code into lowercase, a personal preference, because I like it that way.

At this point I added some commenting, cause that's the kind of guy I am.

Last but not least is the conversion to RPG /FREE

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}