|
I was thinking on this one a bit and aren't sub-procedures main functions
where you pass parms in and get info back.
Much like in other programming I do, I like to think of them as a black
box, especially when used across applications.
If a sub-procedure for some reason uses all the global program variables
and is simply being used to encapsulate some looping logic or something
similar, why not use a subroutine instead ?
Just thinking out loud on this.
I don't do a ton of RPG coding any more so a few example use-cases would
be good to hear about.
Regards,
Richard Schoen
Director of Document Management
e. richard.schoen@xxxxxxxxxxxxxxx
p. 952.486.6802
w. helpsystems.com
----------------------------------------------------------------------
message: 1
date: Mon, 5 Feb 2018 11:23:02 -0500
from: Jon Paris <jon.paris@xxxxxxxxxxxxxx>
subject: Re: What is a Modern RPG Programmer???
I have to agree with Rob on this.
My policy is that if you want to use a subprocedure go ahead. If you want
to use a subroutine then you need to explain to me what benefits it offers
and why you are convinced that it will never need parameters or a return
value.
Future protection - I don't want my programmers producing future relics.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Feb 5, 2018, at 10:57 AM, Rob Berendt <rob@xxxxxxxxx> wrote:--
John Erps,
I didn't say never use a subroutine. I said that I personally went
hardcore on only using subprocedures for a year. And stated my reason.
You can see that below in the thread. Once I broke the habit of
falling back to what was easy and comfortable I used subroutines where
appropriate. I really thought I was quite clear on that.
One thing to keep in mind is to always think of the future.
What may be a subroutine in an existing program could evolve.
- First into a subprocedure
- Next moved out of the main program into a service program.
- Then someone could create a UDF from that service program
subprocedure
- That UDF could be called by SQL with stuff like Select item_number,
onhand(item_number)...
- That UDF could be imbedded into an SQL view Create view Item_user
as (select item_number, onhand(item_number)...
and thus making user queries easier.
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
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
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.