× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Good relevant example.

I understood the reasoning for modularizing but wanted to see an RPG -specific example of that.

As you said it does require some forethought on future use cases.

My usual litmus question is: Will I want to call this code from some other mechanism ? If the answer is Yes, then it needs to be modularized.

Regards,
Richard Schoen
Director of Document Management
e. richard.schoen@xxxxxxxxxxxxxxx
p. 952.486.6802
w. helpsystems.com

------------------------------

message: 5
date: Mon, 5 Feb 2018 12:32:28 -0500
from: Rob Berendt <rob@xxxxxxxxx>
subject: Re: What is a Modern RPG Programmer???

Richard,

In my case the first reason I used a subprocedure instead was to force myself to make subprocedures the habit and subroutines the exception.
Otherwise it was just easy to fall back to what was easier and more comfortable.
The second reason was to see if it could be pushed along the evolutionary path.

Ok, using your global variable example. BPCS does not have an on-hand field. To calculate on-hand you have to use onhand = OpeningBalance + Receipts + Adjustments - Issues And, unless you also subprocedure your file i/o these are usually global variables.
So you're thinking why make these a subprocedure vs a subroutine? Follow along...

Let's say you make this a subprocedure so you can then do currentOnHand = onhand(OpeningBalance, Receipts, Adjustments, Issues) Ok, not very clear why this would be anymore productive? I totally agree.
However follow along...

So now you move this subprocedure out into a service program.
So now you create a function
Create Function OnHand as...
And your function calls your external RPG subprocedure export from your service program.
Still not intuitively obvious as to why this is more productive? I can understand. Follow along...

Now you create a view
Create View IimView as (
select colA, colB, ...,
onhand(OpeningBalance, Receipts, Adjustments, Issues) as OnHandBalance from iim...

Now your users can use their favorite query tool to query the data and no longer have to calculate the onhand (and risk getting it wrong) on each and every query they write. They query the IimView instead of the IIM file directly. And if you choose to use the view to pretty up the columns, like change the names from IMOPB, IMREC, IMADJ, IMISS, IMBS :-) to more meaningful names, convert the 8,0 date formats into real dates, etc you can.
Now, does that make some sense? You really have to look long term.




Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.