Setting RPG Slash Free - Step 4 of 4
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