Honestly, I misread your original post and for some reason thought you were using an intermediate variable, which is why I did it that way. I was skimming too quickly.

Yes, returning a Boolean will allow it to be called directly in a condition. As to how to name it, you can ask 5 different developers and get 5 different answers.

Your example of adding "Selected" is perfectly reasonable. If you wanted to shorten it, do you really need to know that it is a window in the procedure name? Would PromptOrgSelected() be sufficient? Or, would even OrgSelected() or OrgPrompted() get the job done?

I bring this up, because as Buck points out, namespacing your procedures is generally a good idea. So now your already long procedure name is going to get longer.

Brian May
Director
Pre-Sales and Customer Solutions
Profound Logic Software
http://www.profoundlogic.com
937-439-7925 Phone
877-224-7768 Toll Free



The IBM i Modernization Experts
www.profoundlogic.com
             


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Dan
Sent: Friday, August 04, 2017 2:31 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Service program / procedure design and naming conventions

On Fri, Aug 4, 2017 at 3:03 PM, Brian May <bmay@xxxxxxxxxxxxxxxxx> wrote:

I wouldn't pass back the literals "Selected" or "Canceled" as the
return value. Pass back an indicator. Then your code will be more streamlined.

Org_Selected = PromptWindowOrg(...);

If Org_Selected ;
//Do stuff
EndIf;


Thanks Brian!

I'm genuinely curious: Why do you suggest that your example is more streamlined than mine? I actually started with returning an indicator, but I felt like I'd have to name the procedure "PromptWindowOrgSelected", which seemed an odd name to me:
If PromptWindowOrgSelected(...);
// do stuff
Endif;

That's how I ended up with the convention I used. But I am open to changing that.

- Dan
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-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 thread ...

Follow-Ups:
Replies:

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.