× 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.



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;

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 1:25 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: Service program / procedure design and naming conventions

Having finally been given permission to design and implement a service program that will be placed into production and serve as a proof-of-concept for my colleagues who have no to little experience with developing service programs, I am striving to make this first one something that can be used as a reference for others.

In our shop, we make extensive use of F4=Prompt on certain input-capable fields to display a window subfile that allows the user to select from a list of valid records populated by a master file. Two "biggies" in our shop are Organization and Sub-Organization, aka Org and SubOrg. Currently, all of this logic is replicated in every program that uses it, one subroutine for each master file that we prompt for in any given program.
In every case, only one selection from the window subfile can be made.

Based on this, I am designing my prototype as follows:
1) The return value will be either 'Selected' or 'Canceled', based on whether the user made a selection from the window subfile.
2) If there are any key values needed to filter the subfile list, those are the first parameters. In my example, SubOrg requires the Org key value to filter the list. Org has no "higher level" key (my terminology sucks,
sorry) for which Org can be filtered.
3) The last parameter is the database record selected by the user.

d PromptWindowOrg...
d pi 10a
d SelectedRecord LikeRec( RstIndx02 )

d PromptWindowSubOrg...
d pi 10a
d OrgID 4a
d SelectedRecord LikeRec( SubOrgL2 )

Usage example:

If PromptWindowOrg( SelectedRecordOrg ) = 'Selected'; ... do stuff like set display's Org ID and name field values to that returned by procedure Endif;

If PromptWindowSubOrg( xx_OrgID : SelectedRecordSubOrg ) = 'Selected'; ... do stuff like set display's SubOrg ID and name field values to that returned by procedure Endif;

Suggestions / corrections / opinions are welcome. I'd also welcome any online resources. I'm still somewhat early in the design that I can change this as required / desired.

- 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.