Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Passing hold files values into a query one after the other.
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Passing hold files values into a query one after the other.
 Login/Join
 
Member
posted
I am in need of some assistance.
Scenario:
I use a sql query to fetch some information like for example emp_id from emp table and I created a hold file (say SQL_DATA).
And in the same fex file I have another query wherein I need to pass emp_id (from the previous hold file SQL_DATA ) one at a time.

At present I’m preparing a string by concatenating all the emp id’s with a “,” and then passing one by one into the query using a loop and GETTOK. Looks is getting broken when we have more id’s. I need to know if there is any other way that we can do this much better and effectively. Thank you

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


WebFOCUS 7.7.05 and 8.x
Windows, All Outputs
 
Posts: 25 | Registered: December 13, 2012Reply With QuoteReport This Post
Guru
posted Hide Post
You don't need the string concatenation, you can loop while you are doing the read:
TABLE FILE EMPLOYEE
BY EMP_ID
ON TABLE HOLD
END
-RUN

-SET &NBREMPLOYEES = &LINES;
-REPEAT READEMPLOYEE &NBREMPLOYEES TIMES

-READFILE HOLD
-TYPE &EMP_ID -*Just for debugging purposes
...insert your query for each employee here

-READEMPLOYEE


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Reply With QuoteReport This Post
Master
posted Hide Post
There are multiple options available. One way is to convert your first query as subquery and use it directly in filter clause of second query. Other way is to use IN FILE option available in SQL, so that there is no need to read one by one and concatenate with comma separation.
Let me know if this works.

Thanks,
Ram
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Reply With QuoteReport This Post
Expert
posted Hide Post
Is the second query FOCUS code or SQL ?

You could join from the hold file to the second query.

With a HOLD file join to RDBMS tables, multiple queries are sent for each record in the hold file.

Without more information about the code you have, a good answer is difficult.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6115 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Member
posted Hide Post
@Ram - I cant use a sub query as the query has to get executed for each emp id seperatly.
@Waz - Both are sql queries.
@J - Option provided you seems to be working in my scenario.
When the loop run for 600 or so it is working fine and when it goes over 700 or so, it is showing "Task error: ERROR WRITING OUTPUT FILE: @0000057. No report to distribute." Do we need to make any settings change on the server. Please guide me. Thank all for your support.


WebFOCUS 7.7.05 and 8.x
Windows, All Outputs
 
Posts: 25 | Registered: December 13, 2012Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Initial thought is that you could try setting agent_refresh=1 on the server. This has been know to help sometimes.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Guru
posted Hide Post
quote:
Task error: ERROR WRITING OUTPUT FILE: @0000057
Does it give you a line number? that makes it sound like it is erring out on the hold file, not the readfile. Maybe you could provide us with your code so we can get a better idea of what you are trying to do and why you need to use my method instead of the others.


WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
 
Posts: 402 | Location: Upland, IN | Registered: June 08, 2012Reply With QuoteReport This Post
Expert
posted Hide Post
The performance issue seems similar to something I had a while ago.

http://forums.informationbuild...587079106#8587079106

I would suggest creating a temporary table in the database and add that to your SQL query, so its one step, not hundreds.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6115 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Guru
posted Hide Post
Hi Prabhakar,

Just a thought, try once with NOCLOSE in READ command.


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 405 | Location: India | Registered: June 13, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Passing hold files values into a query one after the other.

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.