Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Help with filedef append

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Help with filedef append
 Login/Join
 
Gold member
posted
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
 
Posts: 61 | Registered: April 16, 2009Report This Post
Expert
posted Hide Post
The easy answer is to take the (APPEND off of the filedef. What happens if you do that?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Gold member
posted Hide Post
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
 
Posts: 61 | Registered: April 16, 2009Report This Post
Guru
posted Hide Post
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


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
 
Posts: 320 | Location: Memphis, TN | Registered: February 12, 2008Report This Post
Expert
posted Hide Post
-*SET &ECHO = ALL ;
FILEDEF MYFILE DISK MYFILE.TXT(   LRECL 5

-RUN
 
-SET &KOUNTER = 0 ;
-REPEAT BOTTOMLOOP 2 TIMES
-SET &KOUNTER = &KOUNTER + 1;
-SET &NAME = DECODE &KOUNTER( 1 'FRED' 2 'ETHEL' 3 'LUCY' 4 'RICKY');
FILEDEF MYFILE CLEAR
FILEDEF MYFILE DISK MYFILE.TXT(  APPEND   LRECL 5
-RUN
-WRITE MYFILE &NAME  
 
-BOTTOMLOOP
-CLOSE MYFILE
-TYPE READING FIRST FILE
-READ MYFILE NOCLOSE &NAME.A5
-IF &IORETURN NE 0 GOTO eoj ;
-TYPE &NAME &IORETURN

-READ MYFILE NOCLOSE &NAME.A5
-IF &IORETURN NE 0 GOTO eoj ;
-TYPE &NAME &IORETURN
-READ MYFILE NOCLOSE &NAME.A5
-IF &IORETURN NE 0 GOTO eoj ;
-TYPE &NAME &IORETURN
-READ MYFILE NOCLOSE &NAME.A5
-IF &IORETURN NE 0 GOTO eoj ;
-TYPE &NAME &IORETURN
-eoj
-RUN
-TYPE READING 2ND ONE 
-*CLOSE MYFILE
-*FILEDEF MYFILE CLEAR
FILEDEF MYFILE DISK MYFILE.TXT( LRECL 5
 
-RUN
-SET &KOUNTER = 2 ;
-REPEAT BOTTOMLOOP2 2 TIMES
-SET &KOUNTER = &KOUNTER + 1;
-SET &NAME = DECODE &KOUNTER( 1 'FRED' 2 'ETHEL' 3 'LUCY' 4 'RICKY');
-WRITE MYFILE &NAME  
FILEDEF MYFILE DISK MYFILE.TXT(  APPEND LRECL 5
-RUN
-BOTTOMLOOP2
 
-CLOSE MYFILE
-RUN




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
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
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Issue the filedef within the LOOP, just before the TABLE request -- omitting "(APPEND" in iteration 1, including it in 2 through 12.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
Thanks Jack! that worked perfectly!


WebFOCUS 7.7.2
Win2003
Excel, HTML, PDF
 
Posts: 61 | Registered: April 16, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Help with filedef append

Copyright © 1996-2020 Information Builders