August 30, 2006, 03:21 PM
.ericjoining db2 file to wf holdfile?
I'm using SQL to download data from our DB2/AS400 connection and I was wondering if it was at all possible to use either hold or save files as part of those SQL queries. The only reason I ask is because some of our sales history files contain millions of records and this would help filter that amount greatly.
August 30, 2006, 04:08 PM
newtofocusYes it is possible. Joining a hold file to a big DB2 table is tricky. The way iWay/WebFOCUS works in this situation is it will send as much of the query it can DB2 bring back the data and then do the join in the reporting server. So if you have good filtering criteria that restricts the data to small subset it works great, if not you are in trouble.
August 30, 2006, 04:18 PM
.ericWell my question is how do I go about writing that SQL statement. What I have goes something like:
SQL DB2 PREPARE SQLOUT FOR
SELECT FIELD1, FIELD2, FIELD3
FROM LIBRARY.FILE JOIN HOLD
ON LIBRARY.FILE.FIELD1 = HOLD.KEYFIELD
WHERE LIBRARY.FIELD.FIELD2 = 'CRITERIA';
END
TABLEF FILE SQLOUT
PRINT *
END
And the error it gives me has something to do with not knowing which library HOLD belongs to....
August 30, 2006, 05:10 PM
KevinGEric,
I am not able to provide a code sample, but we do something like this;
Use the READ command to dynamically build a SQL IN statement from your HOLD file. It involves setting up a counter, looping through your HOLD file using DIALOGUE MANAGER and -READ, and using the resulting IN statement in your WHERE condition rather than trying to JOIN to a file SQL doesn't know about.
Hope this helps,
Kevin
August 30, 2006, 05:14 PM
.ericThats not a bad idea, I will give that a try, Thanks.