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



I'm not sure if this is what you arte looking for but you could create a
new file with the afile keys and the totals with the following:

SELECT A.FIELD1, A.FIELD2, A.FIELD3,
A.FIELD4, A.FIELD5, (
case when a.field6 = ' ' then 1 else 0 end +
case when a.field7 = ' ' then 1 else 0 end +
case when a.field8 = ' ' then 1 else 0 end +
case when a.field9 = ' ' then 1 else 0 end +
case when a.field10= ' ' then 1 else 0 end +
case when a.field11= ' ' then 1 else 0 end +
case when a.field12= ' ' then 1 else 0 end +
case when a.field13= ' ' then 1 else 0 end +
case when a.field14= ' ' then 1 else 0 end +
case when a.field15= ' ' then 1 else 0 end) as fieldcount
FROM afile a join bfile b
on a.field1 = b.field1 and a.field2 = b.field2 and a.field3 =
b.field3 and a.field4 = b.field4 and a.field5 = b.field5


John Arnold
(301) 354-2939


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of donna lester
Sent: Monday, November 12, 2007 3:20 PM
To: RPG programming on the AS400 / iSeries
Subject: SQL needed for this tricky problem

Hello All,
My problem is as below:
====================================================================
When
Field1 of AFILE Equal to Field1 of BFILE
Field2 of AFILE Equal to Field2 of BFILE
Field3 of AFILE Equal to Field3 of BFILE
Field4 of AFILE Equal to Field4 of BFILE
Field5 of AFILE Equal to Field5 of BFILE
I will have to see if there are any entries in
Field6,Field7,Field8,Field9,Field10,Field11,Field12,Field13,Field14,Fiel
d15 of BFILE...
(All these 10 fields from Field6 to Field15 are 1 char defined) If
there are entries in all 10 fields then the count is 10 If there are
entries in 9 fields then the count is 9 If there are entries in 8 fields
then the count is 8 If there are entries in 7 fields then the count is 7
If there are entries in 6 fields then the count is 6 If there are
entries in 5 fields then the count is 5 If there are entries in 4 fields
then the count is 4 If there are entries in 3 fields then the count is 3
If there are entries in 2 fields then the count is 2 If there are
entries in 1 fields then the count is 1 If there are no entries in any
of the fields then the count is 0...
what I want to do is
I want to insert this count field in the AFILE when each record of AFILE
is equal to its matching record in BFILE based on the below conditions
Field1 of AFILE Equal to Field1 of BFILE
Field2 of AFILE Equal to Field2 of BFILE
Field3 of AFILE Equal to Field3 of BFILE
Field4 of AFILE Equal to Field4 of BFILE
Field5 of AFILE Equal to Field5 of BFILE
All help is greatly appreciated!




Thanks,

Donna.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
This is the RPG programming on the AS400 / 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.

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.