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     [CLOSED] Problem with USE command when using in repeat loops

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Problem with USE command when using in repeat loops
 Login/Join
 
Gold member
posted
Hi,

I have procedure with 10 systems and 3 regions, each system creates one hold file. These 10 hold files are combined by using USE command. Now repeating the same procedure by passing region value to separate the report region wise. First hold file creating correctly and when creating for region2 hold file it is appending the region1 records also. When I pass region3 the file comes with all three regions data.
I used USE CLEAR * but not clearing. I want clear for each loop and it should be like first time run

Example:

-SET &ECHO = 'ALL';
-SET &RGN = 'A1';
-SET &FINLFILE = 'FILEA';
-GOTO STRTPRG;
-B1
-SET &RGN = 'B1';
-SET &FINLFILE = 'FILEB';
-GOTO STRTPRG;
-C1
-SET &RGN = 'C1';
-SET &FINLFILE = 'FILEC';
-STRTPRG
-IF &RGN NE 'A1' THEN GOTO SKIPA1;
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS HOLD1 FORMAT FOCUS
END
-RUN
-*-*
-SKIPA1
-IF &RGN NE 'B1' THEN GOTO SKIPB1;
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'JAPAN';
ON TABLE HOLD AS HOLD2 FORMAT FOCUS
END
-RUN
-SKIPB1
-*
-IF &RGN NE 'C1' THEN GOTO SKIPC1;
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'ITALY';
ON TABLE HOLD AS HOLD3 FORMAT FOCUS
END
-RUN
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'FRANCE';
ON TABLE HOLD AS HOLD4 FORMAT FOCUS
END
-RUN
-SKIPC1
USE CLEAR *
USE
HOLD1 AS HOLD1
HOLD2 AS HOLD1
HOLD3 AS HOLD1
HOLD4 AS HOLD1
END
-RUN
APP HOLD acctpay
-RUN
TABLE FILE HOLD1
PRINT *
ON TABLE HOLD AS &FINLFILE FORMAT FOCUS
END
-RUN
-IF &FINLFILE EQ 'FILEA' THEN GOTO B1 ELSE IF &FINLFILE EQ 'FILEB' THEN GOTO C1 ELSE GOTO EXTPRG;
-EXTPRG
-EXIT

Thanks,Koti
WF7703, Windows 7

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


WebFOCUS 8104/7703/769/764, Windows 7, Oracle 11g, DB2, QAD
 
Posts: 49 | Location: Chennai | Registered: May 20, 2008Report This Post
Expert
posted Hide Post
This sample fex does not run all the way through - I get an error because HOLD2-HOLD4 do not exist.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
The problem might be in the APP HOLD command. The FOCUS databases are physically created in app folder acctpay, so they will be there if you loop through the fex several times. Though it might also be possible that they'll repeatedly be read even if they're not in the app folder. Perhaps you need to append the region to the database name when creating/reading the databases.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
To use your code as a base, you just need a little judicial use of Dialog Manager magic -

-SET &ECHO = 'ALL';
-DEFAULTH &Hold1 = '', &Hold2 = '', &Hold3 = '', &Hold4 = ''
-SET &RGN = 'A1';
-SET &FINLFILE = 'FILEA';
-GOTO STRTPRG;
-B1
-SET &RGN = 'B1';
-SET &FINLFILE = 'FILEB';
-GOTO STRTPRG;
-C1
-SET &RGN = 'C1';
-SET &FINLFILE = 'FILEC';
-STRTPRG
-IF &RGN NE 'A1' THEN GOTO SKIPA1;
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS HOLD1 FORMAT FOCUS
END
-RUN
-SET &Hold1 = IF &LINES EQ 0 THEN '' ELSE 'HOLD1 AS HOLD1';
-*
-SKIPA1
-*
-IF &RGN NE 'B1' THEN GOTO SKIPB1;
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'JAPAN';
ON TABLE HOLD AS HOLD2 FORMAT FOCUS
END
-RUN
-SET &Hold2 = IF &LINES EQ 0 THEN '' ELSE 'HOLD2 AS HOLD1';
-*
-SKIPB1
-*
-IF &RGN NE 'C1' THEN GOTO SKIPC1;
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'ITALY';
ON TABLE HOLD AS HOLD3 FORMAT FOCUS
END
-RUN
-SET &Hold3 = IF &LINES EQ 0 THEN '' ELSE 'HOLD3 AS HOLD1';
-*
TABLE FILE CAR
PRINT CAR COUNTRY RETAIL_COST
WHERE COUNTRY EQ 'FRANCE';
ON TABLE HOLD AS HOLD4 FORMAT FOCUS
END
-RUN
-SET &Hold4 = IF &LINES EQ 0 THEN '' ELSE 'HOLD4 AS HOLD1';
-*
-SKIPC1
USE CLEAR *
USE
&Hold1.EVAL
&Hold2.EVAL
&Hold3.EVAL
&Hold4.EVAL
END
-RUN
-*APP HOLD acctpay
-RUN
TABLE FILE HOLD1
PRINT *
ON TABLE HOLD AS &FINLFILE FORMAT FOCUS
END
-RUN
-IF &FINLFILE EQ 'FILEA' THEN GOTO B1 ELSE IF &FINLFILE EQ 'FILEB' THEN GOTO C1 ELSE GOTO EXTPRG;
-EXTPRG
-EXIT

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Gold member
posted Hide Post
Hi Tony,

Thanks for the information. I have implemented logic by using Dialog manager commands.

Thanks,
Koti


WebFOCUS 8104/7703/769/764, Windows 7, Oracle 11g, DB2, QAD
 
Posts: 49 | Location: Chennai | Registered: May 20, 2008Report This Post
Expert
posted Hide Post
Koti,

You're welcome.

Incidentally, I would be inclined to use the following syntax at the end of your sample code as it would ensure that the only items written to your target application folder are the .MAS and .FOC files that you want.
-*APP HOLD acctpay
-RUN
TABLE FILE HOLD1
PRINT *
ON TABLE HOLD AS acctpay/&FINLFILE FORMAT FOCUS
END
-RUN
-IF &FINLFILE EQ 'FILEA' THEN GOTO B1 ELSE IF &FINLFILE EQ 'FILEB' THEN GOTO C1 ELSE GOTO EXTPRG;
-EXTPRG
-EXIT

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report 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     [CLOSED] Problem with USE command when using in repeat loops

Copyright © 1996-2020 Information Builders