I'm not sure I can explain it, but I think you want to take the tests for a.mxtfrm and a.mxtdt out of your EXISTS clause, since they don't care about anything in xRouteMax:

Exec Sql
Update plnmaxl1 as a
Set a.mxUdt = :xDate,
a.mxUtm = :xTime,
a.mxUop = 'SPR33684',
a.mxCpdy = 'Y',
a.mxUty = 'C'
Where a.mxtfrm = 'V'
and a.mxtdt = 0
and exists
(select * from xplnMax as b
where a.mxplan = b.mxplan and
a.mxdiv = b.mxdiv and
a.mxins = b.mxins and
a.mxben = b.mxben and
a.mxppo = b.mxppo);

Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> writes:
I'm sure I'm not making myself very clear on this.

I have two PF:

xRouteMax - Contains 988 records
RouteMax - Contains over 22 mil records

I need to update RouteMax reocrds that match xRouteMax records and there
can possibly be mutliple records in RouteMax.

Both files have the same field names and length so I am qualifying them
with a for RouteMax and b for the work file xRouteMax.

I've done this several ways and I keep updating 980 records when in fact I
should be updating 988.

Here is the update statement:

Exec Sql
Update plnmaxl1 as a
Set a.mxUdt = :xDate,
a.mxUtm = :xTime,
a.mxUop = 'SPR33684',
a.mxCpdy = 'Y',
a.mxUty = 'C'
Where exists
(select * from xplnMax as b
where a.mxplan = b.mxplan and
a.mxdiv = b.mxdiv and
a.mxins = b.mxins and
a.mxben = b.mxben and
a.mxppo = b.mxppo and
a.mxtfrm = 'V' and
a.mxtdt = 0);

In this particular case I have two reoords in RouteMax that are an exact
matching except for the mxtdt field, the first record has a value
(20121015) and the second record has a value of 0; otherwise, all the
fields match. This record with the ZERO never gets updated.

I hope this helps explain my issue


Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA 01376
413-676-3144
Internal: x 444
mnaughton@xxxxxxxxxxxx
****************************************
NOTICE: This e-mail and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivering to the intended recipient, be advised that any use is
strictly prohibited. If you have received this e-mail in error, please notify us immediately by replying to it and then delete it from your computer.


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.