Views are the most powerful tool for moving business logic from the program
(source code) into the database.
In this way your source code can be reduced to a minimum. The same view can
be used in any program/procedure or whatever written in any language that
"speaks" SQL and even in good old QUERY/400 views can be used.
So the view is reusable.
I'd not insist in writing by force a view per program. You may end up
automatically with this solution, if you try to reduce your source code to a
(few) cursors and select ... into statements based on simple
SELECT-Statements, i.e. SELECT Col1, Col2, ... ColX from View Where ...
Order By etc.
Just for information it is also possible generating a view over a view,
which is sometimes necessary.
There may be also tools for example generating web applications that can
only handle a single "file", "view" for preparing a "subfile".
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von Vicki
Wilson
Gesendet: Tuesday, 09.9 2014 01:18
An: rpg400-l@xxxxxxxxxxxx
Betreff: One view per program?
I've been using SQL for years. But was humbled at the recent OCEAN
conference to realize how much there is to learn. I've never used views
before. I'm starting to grasp the importance of using them and flexibility
they provide but I still can't quite wrap my head around the idea of "one
view per program."
From p.258 of the Modernization
redbook<
http://www.redbooks.ibm.com/abstracts/sg248185.html?Open> "The view
should be specific to your program." Am I misreading this to think that
means one view per program? I've seen this idea referenced in other posts
here. I understand a change to the view will only be required if a table
change impacts the view. But one view per program still seems like a
potential maintenance hassle?
Thoughts on the subject? Other references?
Vic
--
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.
As an Amazon Associate we earn from qualifying purchases.