Focal Point
join files

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6141065931

November 29, 2005, 04:44 PM
Lloyd
join files
Does anyone know why I would this error or more important, what does mean?

(FOC236) LINKED FILE DOES NOT HAVE A MATCHING KEY FIELD OR SEGMENT: LOCATION

Here is my code, I don't see a problem --- is there a limitation for using join fields with format focus? If I only use one key(which would make my data wrong) I don't get an error. I would really hate to have to cfreate a temp field just for the join.

  
SQL
SELECT SLSRGN AS REGION, SLSVND AS VENDOR, SLSSTR AS STORE, SLSSTN AS STOREN,
SLSSTY AS STYLE,  SLSDSC AS STYLED, SLSSKU AS SKU, MAX(SLSCLR) AS COLOR,
SUM(SLSQTY) AS QUANTITY,
SUM(SLSRET) AS RETAIL,
SUM(SLSCST) AS COST
FROM SLSSKU
-IF &TYPE NE 'LTD'  GOTO SKIP_LTD;
-GOTO SKIPP
-SKIP_LTD
-IF &TYPE NE 'YTD'  GOTO SKIP_YTD;
WHERE SLSFYR = &YEAR
-GOTO SKIPP;
-SKIP_YTD
-IF &TYPE NE 'MTD'   GOTO SKIP_MTD;
WHERE SLSFYR = &YEAR AND SLSFPD = &MONTH
-GOTO SKIPP;
-SKIP_MTD
-SKIPP
GROUP BY SLSRGN, SLSVND, SLSSTR, 
SLSSTN, SLSSTY, SLSDSC, SLSSKU;
TABLE ON TABLE HOLD AS SLSTOP20 
FORMAT FOCUS INDEX  SLSSTR SLSSKU 
SLSRGN SLSVND  SLSSTN   SLSSTY SLSCLR
END
SQL
SELECT LOCNUM AS STORE, LOCSKU AS SKU, SUM(LO****) AS ONHAND
FROM LOCINV
GROUP BY LOCNUM, LOCSKU;
TABLE ON TABLE HOLD AS LOCATION 
FORMAT FOCUS INDEX  LOCNUM LOCSKU
END
JOIN
SLSTOP20.SEG01.SKU AND SLSTOP20.SEG01.STORE IN SLSTOP20 TO ALL
LOCATION.SEG01.SKU AND LOCATION.SEG01.STORE IN LOCATION AS J1
END

This message has been edited. Last edited by: <Mabel>,


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
November 29, 2005, 04:52 PM
N.Selph
When joining Focus files you can only use one field. So you would have to make temporary fields to join on.


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
November 29, 2005, 04:57 PM
Lloyd
That is so lame!!!!!

This message has been edited. Last edited by: Lloyd,


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
November 29, 2005, 05:20 PM
Mikel
Lloyd, you are using SQL to retrieve data... so, in this case, it's not better change your SQL code in order to join the data?

Also you can use MATCH FILE.

Mikel


WebFOCUS 8.1.05, 8.2.01
November 29, 2005, 05:55 PM
Lloyd
Not really. If you look at the sql, it's a many-to-one join file that I want summarize and filter before I join the files.

I am not that comfortable with match files. I use SQL mostly because it's second nature to me since I've used it for so long and work with it in many different languages. Match file is only good for webfocus so picking it up hasn't really been high on my to do list.

I have my hands in so many projects It's easier to go with what you know when you can.


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
November 29, 2005, 07:21 PM
susannah
n.selph, its just in the target file that a single key field is required. the source can specify several fields in the order they exist in the target key field.
so, in this case, in the creation of the LOCATION file, a single key needs to be made from the locnum and locsku fields and the join would be fine;




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 30, 2005, 09:00 AM
mgrackin
Lloyd,

We can all relate to being frustrated with certain aspects of any programing language or tool within our prfession. However, please refrain from posting objectionable comments which do not add value to this form or the question at hand (JOINing files).

Thanks.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
November 30, 2005, 09:23 AM
Tony A
Lloyd,

I must say that I agree with Mickey.

As SQL is so second nature then why have you not thought about achieving the whole thing in SQL?

Something along the lines of -
ENGINE SQLMSS SET SERVER data-adapter-id
SET SQLENGINE = SQLMSS (or what ever yours is)
SQL
SELECT SLSRGN AS REGION
     , SLSVND AS VENDOR
     , SLSSTR AS STORE
     , SLSSTN AS STOREN
     , SLSSTY AS STYLE
     , SLSDSC AS STYLED
     , SLSSKU AS SKU
     , MAX(SLSCLR) AS COLOR
     , SUM(SLSQTY) AS QUANTITY
     , SUM(SLSRET) AS RETAIL
     , SUM(SLSCST) AS COST
     , (SELECT SUM (LO****)
          FROM LOCINV S1
         WHERE T1.SLSSTR = S1.LOCNUM
           AND T1.SLSSKU = S1.LOCSKU
         GROUP BY LOCNUM, LOCSKU) AS ONHAND
  FROM SLSSKU T1
-IF &TYPE NE 'LTD'  GOTO SKIP_LTD;
-GOTO SKIPP
-SKIP_LTD
-IF &TYPE NE 'YTD'  GOTO SKIP_YTD;
WHERE SLSFYR = &YEAR
-GOTO SKIPP;
-SKIP_YTD
-IF &TYPE NE 'MTD'   GOTO SKIP_MTD;
WHERE SLSFYR = &YEAR AND SLSFPD = &MONTH
-GOTO SKIPP;
-SKIP_MTD
-SKIPP
GROUP BY SLSRGN
       , SLSVND
       , SLSSTR
       , SLSSTN
       , SLSSTY
       , SLSDSC
       , SLSSKU
;

should do the trick.



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
November 30, 2005, 09:47 AM
Lloyd
To all:
I am sorry if my comment offended anyone, but I have seen other members voice thier displeasure at certain answers that they disagree with, so I have no idea why I am being taken to task.???

Tony A: you are 100% correct, I normally shy away from sub-selects, but in this case it would fit bill perfectly. I just had it my mind to summarize then join.....


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
November 30, 2005, 10:41 AM
mgrackin
Lloyd,

You are free to express frustration and/or disagreement. I have done this myself on occasion when I disagree with a post. Your choice of words is what we are taking exception to. I cannot recall ever seeing any other post on Focal Point which used words that necessitated the use of * asterisks.

Ironically I experienced the same error this week which you began the discussion about. Although it was not in the context of using SQL. I found it frustrating as well being a little rusty with my JOIN syntax. We all can agree that some things are frustrating. However, when we express that frustration or disagreement on Focal Point we need to choose our words wisely.

Thanks for your understanding.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
November 30, 2005, 11:13 AM
Lloyd
Mickey, point taken.


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
November 30, 2005, 12:37 PM
Lloyd
Tony A:
I get this error when I try the subselect, only thing I did differntly was I omitted:

ENGINE SQLMSS SET SERVER data-adapter-id
SET SQLENGINE = SQLMSS (or what ever yours is)

  
(FOC14069) SYNTAX ERROR ON LINE 12 AT 'SUM'  -- Expected ')'
 0 ERROR AT OR NEAR LINE     71  IN PROCEDURE MEMFEX  FOCEXEC *
 (FOC003) THE FIELDNAME IS NOT RECOGNIZED: ONHAND
 BYPASSING TO END OF COMMAND
 (FOC009) INCOMPLETE REQUEST STATEMENT



I've never used ENGINE or SQLENGINE, we have all of our tables on an AS/400 which we access thru EDA on a WINNT machine. When I tried those commands I got errors. What Do they do? how can I determine what values should be used?


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
November 30, 2005, 05:24 PM
Tony A
Lloyd,

The method you are using (e.g. without the ENGINE etc.) is still being parsed first using the synonym. The SQL using this method cannot include subselects etc.

When you include the ENGINE etc. then the SQL will be passed (and not parsed) direct to the data adapter and therefore can include SQL syntax that the data adapter can handle.

I realise you have AS400 but without knowing what database you are targetting (e.g DB2, Oracle, MS SQL etc.) cannot help you with the ENGINE settings you require (I am also at home - told you I was sad). I'm sure that there is someone out there that can help we just need to know what database on your platform you are using.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 01, 2005, 10:38 AM
Lloyd
Tony A:
We are DB2 on the AS/400.
My DB Name is MK400A

I don't think we have the adapters set up properly, we had a consulting group do our install and configuration. So Iam not sure what was setup and what wasn't. We took courses 351 and 354 which didn't cover this at all. I looked at some of the manual but they seem pretty daunting. What course would you suggest to take to get a handle on the setup and configuring of the adapters? There are techniques that I think would benefit our shop (such as Stored Procedures), But I don't know how to implement them.

Any suggestions?


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0
December 01, 2005, 11:13 AM
Tony A
Lloyd,

Sorry, can't advise on courses as they've changed somewhat since I did either of the two that I have done Wink.

However, identifying your data adapter name and ENGINE type is easier than I made out (sorry). Just open one of your ACX files in text editor and note the CONNECTION value. Now open the equivalent MAS file and note the SUFFIX value.

You settings should be -

ENGINE [suffix value] SET SERVER [connection value]
SET SQLENGINE = [suffix value]

Hopefully that should get you going.

Good luck.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 01, 2005, 12:11 PM
Lloyd
Tony:
OK, my Conection is MK400A, but my suffix value was set to EDA.

I just realized that the AS/400 was setup as a remote server. Will that make a difference?


Lloyd Prendergast
Michael Kors (USA), Inc.
Phone: 201-453-5076
Fax: 646-354-4776
Lloyd.Prendergast@Michaelkors.com


WebFOCUS 523
WebFOCUS 7.6
WebFOCUS 7.7

Windows Server 2005
Windows Server 2008

Iseries V5R3M0
Iseries V5R5M0
Iseries V6R1M0