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     -READ multiple values

Read-Only Read-Only Topic
Go
Search
Notify
Tools
-READ multiple values
 Login/Join
 
Silver Member
posted
I have a text file that basically lists a bunch of ID numbers that I'd like to place in an & variable in a program I'm writing. I know I can read a value into a variable using -READ, but at this time I'm only getting the first value. I'd like to use all of the values in my file. I have one ID number per line. How would I read in more than one value? This is what I have so far. In the documentation they only show one value being read in.

FILEDEF IDLIST DISK myfile.ftm
-RUN
-SET &IDNUM = ' ';
-READ IDLIST &IDNUM.A9.

TABLE FILE PROSPECTS
PRINT ID LAST_NAME FIRST_NAME
IF ID EQ '&IDNUM'
END
 
Posts: 46 | Location: Taylor University in Upland Indiana | Registered: May 20, 2003Report This Post
Silver Member
posted Hide Post
Based upon your query, why don't you change

IF ID EQ '&IDNUM'

to

WHERE ID IN FILE IDLIST

But if you need to read multiple times, then use a REPEAT loop and the NOCLOSE option to READ.
 
Posts: 40 | Registered: March 10, 2004Report This Post
Silver Member
posted Hide Post
Thank you!!! This works very well.
 
Posts: 46 | Location: Taylor University in Upland Indiana | Registered: May 20, 2003Report This Post
Silver Member
posted Hide Post
I believe there is a limit to the number of lines I can have in my external file using the IN FILE in my where statement.
 
Posts: 46 | Location: Taylor University in Upland Indiana | Registered: May 20, 2003Report This Post
Platinum Member
posted Hide Post
Yes, 16 or 32K depending syntax or release.

See Reading Selection Values From a File

Regards,
Mikel
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
<Pietro De Santis>
posted
From tech support:

quote:

when using WHERE ... IN FILE syntax, you should try using IF ... EQ (ddname) syntax instead. Currently, the supported number of bytes for IF ... EQ (ddname) syntax is approximately 32K for FOCUS databases and relational files. In the case of WHERE ... IN FILE syntax, the limit is approximately 16,000 bytes.
As well, you may reach a limit when the FOCUS code is translated to SQL - I think there's a limit of 1000 values for a where statement in Oracle.

You may need to use MATCH FILE...
 
Report This Post
Expert
posted Hide Post
-READ IDLIST NOCLOSE &IDNUM.A9
-IF &IORETURN NE 0 GOTO EOJ;

it'll work like a charm. next loop thru, you'll read the next record.
&IORETURN will be some goofy number like -1 when it hits endoffile.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
<Vipul>
posted
Pietro and Susannah,

I have been doing -READ in a loop and have not used noclose option...seems to be working fine. So what is the difference?

Vipul
 
Report This Post
<Pietro De Santis>
posted
The NOCLOSE option ensures that, if you have FOCUS code (TABLE FILE etc.) within the loop, the progam does not get lost while READing the file. If you had FOCUS code within the loop without NOCLOSE, the program would always read the first row and you would get an endless loop.

Cheers.
 
Report This Post
<Vipul>
posted
Yup,

I read the documentation. I am using db2 on unix.
I am not using the external files.

Vipul
 
Report This Post
Virtuoso
posted Hide Post
I just wanted to clarify the need for the NOCLOSE. When doing a -READ on a file, the file will be closed when FOCUS executes the commands on the command stack or, in other words, when it encounters a -RUN or the end of a FOCEXEC. Having TABLE FILE in your request after a -READ does not cause FOCUS to close the file unless, of course, you have a -RUN after the TABLE FILE.

One of the old ways of getting around this issue of the file closing was simply to do a loop around the -READ and TABLE FILE code (without a -RUN in the loop) for each value/record read from the file, causing FOCUS to stack all the commands. When the loop had read all the values in the file, it would then drop out of the loop to a -RUN which would then cause FOCUS to run all the stacked TABLE FILE requests. Not pretty, but it worked. The NOCLOSE is a much better way of doing this.

Just wanted to give a little clarification on this issue.
 
Posts: 995 | Location: Gaithersburg, MD, USA | 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     -READ multiple values

Copyright © 1996-2020 Information Builders