Title: | FOCUS, from INFORMATION BUILDERS |
Moderator: | ZAYIUS::BROUILLETTE |
Created: | Thu Feb 19 1987 |
Last Modified: | Mon May 05 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 615 |
Total number of notes: | 1779 |
Hi, Seems like I'm the only one entering notes in here recently......is there anybody out there ? Another little tadgette of a problem...has anybody managed to resolve a many to many join yet? if so how.... I have two files, both with duplicate values over which I need to join and pick up associated codes.... File 1 File 2 Cost Centre Cost Centre Value Code In both cases the Cost centre is duplicated in both files but I need to be able to SUM value for file 1 where Code in file 2 is as specified. There are cases where Code in file 2 can have the same Cost Centre... File 1 File 2 --------------------------------- Record 1 XYZ XYZ 100 CODEA Record 2 XYZ XYZ 99 CODEB A conventional JOIN using Cost Centre only picks up the first instance of a matching cost centre in file 2, where as a JOIN with the ALL qualifier produces a 'duplicates in HOST' error.... Any suggestions appreciated. Gary.
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
582.1 | Have you tried using a match instead of a join? | DEVLPR::CIONI | Fri Jun 03 1994 14:04 | 22 | |
Just thinking that would probably suit your purpose better Something like: MATCH FILE FILE1 SUM VALUE BY COST_CENTER RUN FILE FILE2 BY COST_CENTER BY CODE ON MATCH HOLD NEW END Your result will be all in the second file with the overlap of the sum from file1. If that hold option doesn't work - there are others to try for your needed result. Lisa | |||||
582.2 | FOCUS$DUFF ! | REPROT::MCSHANEG | Deceptively Co-operative | Sun Jun 05 1994 17:09 | 28 |
Lisa, Thanks for the reply...I have, since entering my original note attempted to use a MATCH statement but with no luck, I end up with missing elements all over the place.. my explanation of the two files was not very clear, the field 'cost centre' in both files occurs many times in both files though is still the only common field, so a MATCH didn't work as MATCH like DECODE seems to work on the first element found. I then generated a unique file to which I managed to JOIN to two other files so allowing a many to many join via a single common field. This looked ok when a CHECK FILE PICT was issued, however, in attempting to access the structure for reporting I got two FOCUS errors I've not had before...FOC144 and FOC030, both confusing in their explanation when considering the JOIN'd structure is supposed to be viewed by FOCUS as a single structure. After many late nights and much head scratching I've given up and have written a small DTR procedure which creates unique records from the two files and passes these back to FOCUS for the final TABLE FILE.... Thanks Gary look ok | |||||
582.3 | DEVLPR::CIONI | Fri Jun 10 1994 13:47 | 8 | ||
Was your unique file indexed? Post your code if you can...and the error messages... I guess once I get started on trying to solve a problem, I can't put it down :^) Lisa | |||||
582.4 | Problem now fixed, but FYI.... | CHEFS::GARMCS::MCSHANEG | Deceptively Co-Operative | Tue Jun 14 1994 07:59 | 67 |
Lisa, The problem has been solved now but I have attached the two .MAS files FYI I was attempting to JOIN/MATCH. The common field is the one flagged as occurring many times......as I say, it's been fixed now so don't drive yourself nuts looking for a solution.... The two error Messages were... (FOC144) NOTE...TESTING IN INDEPENDENT SETS OF DATA ? The request references sets of multiply occuring data which are independent of each other. (FOC030) SORT KEYS NOT IN PATH OF ALL VERB OBJECTS IN VERB SET The request statement contains an illogical sort condition re- lative to the field to be retrieved and sorted. A multi-set request statement where each set of verb objects have their own sort keys may be appropriate. The error messages were a result of trying access a join structure as follows.....a CHECK FILE PICTURE showed no errors. Many File A>----Unique File----< Many File B Ta, Gary FILE=RUTAB, SEGNAME=WORK,SEGTYP=S1,$ FIELDNAME=COC_CODE, USAGE=A3, ACTUAL=A3,$ <<<<- Occurs many times FIELDNAME=ROLLUP, USAGE=A4, ACTUAL=A4,$ FIELDNAME=DTL, USAGE=A1, ACTUAL=A1,$ FIELDNAME=RU_LCL, USAGE=A1, ACTUAL=A1,$ FIELDNAME=RU_ACT, USAGE=A1, ACTUAL=A1,$ FIELDNAME=RU_CON, USAGE=A1, ACTUAL=A1,$ FILE=CCACT2,SUFFIX=FIX SEGNAME=CCACT2 FIELDNAME=JUL,E01,D7.1,D08,$ FIELDNAME=AUG,E02,D7.1,D08,$ FIELDNAME=SEP,E03,D7.1,D08,$ FIELDNAME=OCT,E04,D7.1,D08,$ FIELDNAME=NOV,E05,D7.1,D08,$ FIELDNAME=DEC,E06,D7.1,D08,$ FIELDNAME=JAN,E07,D7.1,D08,$ FIELDNAME=FEB,E08,D7.1,D08,$ FIELDNAME=MAR,E09,D7.1,D08,$ FIELDNAME=APR,E10,D7.1,D08,$ FIELDNAME=MAY,E11,D7.1,D08,$ FIELDNAME=JUN,E12,D7.1,D08,$ FIELDNAME=YEAR,E13,D9.1,D08,$ FIELDNAME=COC_CODE,E14,A3,A04, <<<<-Occurs many times MISSING=ON,$ FIELDNAME=NATURE,E15,A3,A04,$ FIELDNAME=CMV,E16,D7.1,D08,$ FIELDNAME=FISCAL_YEAR,E17,A4,A04, MISSING=ON,$ FIELDNAME=CCOA_GRP_DESC,E18,A25,A28,$ FIELDNAME=CCOA_DET_DESC,E19,A37,A40,$ | |||||
582.5 | not indexed... | PEKING::MCSHANEG | Deceptively Co-operative | Tue Jun 14 1994 18:46 | 7 |
re -1 oops..forgot to mention, the unique file used to link the two 'many' type files was produced as a TABLE SAVE type file by using a TABLE FILE against one on the 'many' files... Gary. |