.st0{fill:#FFFFFF;}

RPG Evolution, Modernization and Refactoring – Step 3 of 4 – Paroling RPG4 

 September 13, 2009

By  NickLitten

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 thats the kind of guy I am.

Last but not least is the conversion to RPG /FREE

  1. Take the code and upgrade it to RPG/4
  2. Tidy the Code
  3. Do some Refactoring and make it smile
  4. Evolve to RPG4 and make it awesome

NickLitten


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"cff50":{"name":"Main Accent","parent":-1},"a344d":{"name":"Accent Transparent","parent":"cff50"}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"cff50":{"val":"var(--tcb-skin-color-0)"},"a344d":{"val":"rgba(46, 138, 229, 0.85)","hsl_parent_dependency":{"h":210,"l":0.54,"s":0.78}}},"gradients":[]},"original":{"colors":{"cff50":{"val":"rgb(0, 178, 255)","hsl":{"h":198,"s":1,"l":0.5}},"a344d":{"val":"rgba(0, 178, 255, 0.85)","hsl_parent_dependency":{"h":198,"s":1,"l":0.5}}},"gradients":[]}}]}__CONFIG_colors_palette__

Get In Touch

Iā€™m always looking for awesome input, feedback and critique!

>