Setting RPG Slash Free - Step 4 of 4

Submitted by NickLitten on Sun, 09/13/2009 - 19:13

Convert it to FREE FORMAT

Of course, I use the Projex400 command to do this step. This is what the SETSRCFREE 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: nick...@projex.com *
* *
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
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)
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
/FREE
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;
else;
bodv06 = 0;
endif;
update slr06; // Update Account Balances new Order Total
reade l#cono acsummar;
enddo;
// --- Program Termination ---
out lda;
*inlr = *on;
/END-FREE
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
* standard error handling routine. *
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
/Copy qgpl/qrpglesrc,pssr

Thats the same program in RPG Free Format.

As you can see, I've spaced the code out to make it more readable, added comments, Key Lists are now listed by field and Eval statements are not required and generally kicked it around a bit.

I think it's a huge improvement in readability.

Easier code to read means easier to maintain means saving time means saving money!

What do you think?

 


Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Some Bloke

Projex dot com is the cyber home of Nick Litten an AS400 IBMi developer, RPG programmer, SOA code enthusiast, website tinkerer, information technology evangelist, early adopter, proponent of open source and hopeless technology addict...

Nick Litten looking dazed while refactoring some RPG2 code to kick it into this century

Born and raised in Rainy England, now enjoying programming in the sunshine of Southern USA. Founder of SOFTWARE PROJEX.

Clustermap

Locations of visitors to this page

glqxz9283 sfy39587stf02 mnesdcuix8
sfy39587stf03
sfy39587stf04