I have an include file someone else wrote that I'm trying to modify so that I can call it multiple times from within the same program. Its using a filedef append and my problem is that the second pass seems to sum the numbers with the first pass. So in otherwords, I set &BDGT_HOLD = TABLE1, include the file, and my budget on TABLE1 is 150. Then I set &BDGT_HOLD = TABLE2, include the file and my budget on TABLE2 should be 100, but instead I get 250.
I assume the second pass is appended to the first pass in BDGT_HLDX.FTM, and I would think I need to close or destroy the original file in some way, but I don't know how.
The include file looks something like this (I ommitted a few things):
FILEDEF BDGT_HLDX DISK BDGT_HLDX.FTM (APPEND
-SET &LOOP_CNT=0;
-REPEAT MONBDGT 12 TIMES;
-SET &LOOP_CNT = &LOOP_CNT + 1;
-SET &SAVEHOLD = IF &LOOP_CNT LE 11 THEN 'SAVE' ELSE 'HOLD';
DEFINE FILE BDGT_HOLDX
.... END
TABLE FILE BDGT_HOLDX
SUM
BUDGET
BY FMN
ON TABLE &SAVEHOLD AS BDGT_HLDX FORMAT ALPHA
END
-RUN
-*...put budget numbers into an XFOCUS file...
TABLE FILE BDGT_HLDX
SUM
BUDGET
BY FMN
ON TABLE HOLD AS &BDGT_HOLD FORMAT XFOCUS INDEX FMN
This message has been edited. Last edited by: Kerry,
WebFOCUS 7.7.2 Win2003 Excel, HTML, PDF
July 16, 2009, 04:32 PM
GinnyJakes
The easy answer is to take the (APPEND off of the filedef. What happens if you do that?
Its appending to the file each time it loops. If I remove the append, then I only have 1 line in the file when I should have 12. So essentially I want it to loop 12 times, append a line each time. Clear the File. Loop 12 more and append 12 new lines.
WebFOCUS 7.7.2 Win2003 Excel, HTML, PDF
July 16, 2009, 05:20 PM
Mighty Max
Sounds like you have two loops but I only see one. Anyways you can use DOS commands in Webfocus. So you can do a DOS delete when you need to clear the file.
DOS DEL \\WF_SERVER\IBI\APPS\APP_FOLDER\BDGT_HLDX.FTM
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
July 16, 2009, 06:05 PM
susannah
there appears to me to have been some code tightening... As Ginny says, You may be able to get away with removing the APPEND altogether. but if you're re-executing the fex within the same fex/agent, this will work FILEDEF thing DISK thing FILEDEF thing DISK thing(APPEND seems to clear the existing filedef, and start over. FILEDEF thing CLEAR didn't seem to do anything. -CLOSE thing didn't seem to do anything either. hmm.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
July 16, 2009, 09:43 PM
j.gross
Issue the filedef within the LOOP, just before the TABLE request -- omitting "(APPEND" in iteration 1, including it in 2 through 12.