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



Thanks, I was trying to do it with one request, like this.

update oldfile a
set a.profession = ( select profession from
custmast join custdos on
Custmast.cust = custdos.cust where custdos.dossier = a.dossier )
where exists ( select custdos.dossier from custdos where custdos.dossier= a.dossier )

This worked if the customer had only one dossier.

But I prefer the good old RPG way :
CHAIN dossier custdos;
IF %FOUND;
CHAIN custdos.cust custmast;
IF %FOUND;
profession = custmast.profession;

ENDIF;
ENDIF;




-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de rob@xxxxxxxxx
Envoyé : vendredi 18 juillet 2008 16:34
À : Midrange Systems Technical Discussion
Objet : Re: Updating with the column from another file

With
select $customer, profession
from qtemp.custmast
$CUSTOMER PROFESSION
4 6

and
select $customer, $dossier
from qtemp.custdoss
$CUSTOMER $DOSSIER
4 2
4 7

then start with
select $dossier, profession
from qtemp.custdoss d join qtemp.custmast m
on d.$customer = m.$customer
$DOSSIER PROFESSION
2 6
7 6

and end up with
create table qtemp.dossprof as (
select $dossier, profession
from qtemp.custdoss d join qtemp.custmast m
on d.$customer = m.$customer
) with data

Verified with
select $dossier, profession
from qtemp.dossprof
$DOSSIER PROFESSION
2 6
7 6

Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





David FOXWELL <David.FOXWELL@xxxxxxxxx>
Sent by: midrange-l-bounces@xxxxxxxxxxxx
07/18/2008 10:16 AM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> cc

Subject
Updating with the column from another file






Hi,



I have an old program that produces a file with, amongst other information, $dossier, profession

The profession has to be changed so it comes from the customer master file.
$customer, profession

To get to the customer master file, I'd have to first access the customer/dossier file $customer, $dossier

I just wasted an hour updating profession in the old file with profession from the customer master file with SQL. The problem was that there can be more than one dossier per customer.

So I'm going to write an RPG program that reads the old file, chains on customer/dossier file then on customer master file.


Was this possible in SQL?

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


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.