Q
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Maintaining a logical file

Is it possible to maintain a logical file(LF) with summary information of the data of a physical file (PF) using only DDS? I.e. If the Sales PF contains 10,000 records with invoice number, customer number, and invoice amount (one customer can have many invoices), then I want a LF with total of Invoice Amount for each customer (live summary values). If there is no solution through DDS, is there any other method?
There are no DDS keywords that provide this functionality. One option would be Database triggers. A set of Insert/Update/Delete triggers could be used to do this. Triggers created over the Sales PF would take the changes and then update the appropriate customer summary level in a second PF that holds the summary sales data. A second option would be creating an SQL view (CREATE VIEW sumsales AS (SELECT customer, Sum(Inv Amount) FROM sales GROUP BY customer). This SQL View can be opened as a non-key logical file -- the SQL view would have to recalculate the sales summary for each customer each time the SQL View was opened as a logical file.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: tips, tutorials and more.

Check out this Search400.com Featured Topic: Database issues resolved


This was last published in February 2004

Dig Deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close