RPG Evolution, Modernization and Refactoring – Step 5 of 4 – RPG FREE FORMAT 2017 

 July 12, 2017

By  NickLitten

Convert it to RPG FREE FORMAT — RPG Evolution 2017 style

That’s right — this is step five of four.

Much like RPG evolution, the modern day free-form RPG code is way more advanced than earlier neanderthal column based RPG.

The original code blog was way back in 2009, but RPG has quietly been improving all the time since then. IBM release new opcodes, built in functions, source snippets all the time. Most recently, we had a quite big update which gets rid of H, F and D specs and allows us RPG Nerd to code in almost entirely freeformat.

 // system name: fix slp06 
 // program desc: fix the records on slp06 showing RPG EVOLUTION 
 // program no: ef001 
 // date: 2017.07.12 
 // author: nick@nicklitten.com 
  ctl-opt datfmt(*iso) timfmt(*iso) option(*nodebugio) debug;
  dcl-f EFP01L01 keyed infsr(*pssr); 
  dcl-f ACSUMMAR keyed usage(*update) infsr(*pssr);
 // Externally defined file defn's for *LDA and *PSDS 
  dcl-ds lda extname('LDA') dtaara(*lda) end-ds; 
  dcl-ds pstat ext PSDS extname('PSDS') end-ds;
 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

This is the same old 2009 program in RPG Free Format — aka RPG4 — AKA RPGLE /Free.

I really enjoy coding in the latest /freestyle format of RPG. It makes coding easy, very readable and much easier to maintain. No more lining up screens of code, easy formatting and creation of code snippets (using code editing tools like RDi) and the look and feel of RPG has finally caught up with other modern languages. As I said in the earlier blogs ” Easier code to read means easier to maintain means saving time means saving money!”

What do you think?

Want to read an IBM primer on coding with the RPG language?


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!