MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » July 2008

RE: Updating with the column from another file



fixed

I do complete it with one request:
create table qtemp.dossprof as (
select $dossier, profession
from qtemp.custdoss d join qtemp.custmast m
on d.$customer = m.$customer
) with data


Your RPG is incomplete.
1 - No writes or updates
2 - Where do you get dossier in the first chain? An update/primary on
dossprof?
3 - What happens if either chain is unsuccessful? Shouldn't you purge the
old record from dossprof?

Want to do it with NO requests? Then run these two statements once and
forget about it.
DROP TABLE DOSSPROF

create VIEW qtemp.dossprof as (
select $dossier, profession
from qtemp.custdoss d join qtemp.custmast m
on d.$customer = m.$customer
)

Now, all changes are in sync. If you just have to have a key for Record
Level Access (ie RPG CHAIN) then use a join logical file instead. But if
it's for query only then the view will be just fine.

You can verify that view with
SELECT * FROM QTEMP.DOSSPROF
and you should see
$DOSSIER PROFESSION
2 6
7 6

So, if you add another dossier
INSERT INTO QTEMP.CUSTDOSS VALUES(4,23)

then this:
SELECT * FROM QTEMP.DOSSPROF
will return
$DOSSIER PROFESSION
2 6
7 6
23 6


Rob Berendt





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact