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     FOCUS 7.2.3 Looping Question

Read-Only Read-Only Topic
Go
Search
Notify
Tools
FOCUS 7.2.3 Looping Question
 Login/Join
 
Member
posted
I have an external data set. I'm using a "READ" function to read the first position, which I am using as an indicator to branch to various parts of the focus program. I am also using the &LINES variable to route to the end if there are no records in the data file as well as to compare a "COUNTER" variable to. I have an "-IF" section that analyzes the value of the indicator and then routes it to the appropriate section...or it should. It works fine for the first record, but how and what is the syntax to get this to occur for every record? I thought perhaps I could use the "REPEAT" function, but not having used it before has me somewhat confused with how and where it should be placed in relation to my "IF" statements. The final result should be a series of hold files that will later be appended. Any thoughts would be most appreciated. Thnx in advance!
 
Posts: 12 | Registered: May 07, 2003Report This Post
Expert
posted Hide Post
make sure you use NOCLOSE
-READ filename NOCLOSE &myvar.a80
that means that when you branch back to the top of your loop, you won't be re-reading the first record .
Then, if you already know how many times you're going to be looping, you can use REPEAT.
The syntax is REPEAT statementlabel n TIMES
-SET &KOUNTER = 0;
-REPEAT MYENDLABEL 10 TIMES
-SET &KOUNTER = &KOUNTER + 1;
-READ MYFILE NOCLOSE &MYVAR.A80... whatever
-IF &IORETURN NE 0 GOTO IMOUTOFHERE ;
...do stuff with that &myvar, your IFs can go here. You can have whole wads of focus code here, if you need to.
-MYENDLABEL
-IMOUTOFHERE
optionally, you can put your kounter check in,
perhaps right after you increment it.
but if you're real sure of your loop , you don't need it.
(I use K for Kounter rather than C because i'm a math geek and we use I, J, K for integer incrementers.)

oh, &LINES isn't going to do anything for you here. What you want to check for is &IORETURN
After each read, issue a check on &IORETURN to see if you're at endof file. (EOF=&IORETURN NE 0)
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Thnx so much Susannah...I'll give it a try!
-carolyn
 
Posts: 12 | Registered: May 07, 2003Report 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     FOCUS 7.2.3 Looping Question

Copyright © 1996-2020 Information Builders