|
Kelly,
You don't "exit" a service program...mainly because you never enter it. <grin>
Instead, the service program contains one or more individual procedures. Those procedures can be
called from outside (or inside :) the service program, ie. From your UI program.
You have two options for returning data from a procedure.
1) In an parameter variable
2) As a returned value.
In either case, the data can be a single variable or a DS.
You'll see many of examples of procedures that output/return the contents of the entire record using a
DS defined from the external file. However, I'd argue against doing it that way. When you need to
change the file, you have to recompile the world. The reality is few program really need the entire
record, mainly the just CRUD programs. The rest only need certain parts of the data in the file.
Another technique is to have Getters/Setters that set/return individual fields. Again, I'd argue
against doing it this way. Mostly because you end up duplicating the business logic related to the
fields. In addition, it's more work when you need data out of more than one field.
Instead, consider having procedures that return the data in a business appropriate way. For instance,
a GetDescriptiveInfo() that returns item#, name, size, and other often used together fields. In
addition, if you've currently got Yes/No type flag fields, don't use a GetFlagFld() type procedure to
return the actual value of the field. Instead, use a IsItemSomething() procedure. This way, if you
ever need to change the business logic behind the decision, you only need to change it in one place.
I've gone so far as to have a GetSimpleList() procedure that takes as input, the number of records at
a time you want and an empty DS of the appropriate size to fill; which I can call from multiple
subfile programs, either 5250 or web based.
HTH,
Charles
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.