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.
I have a fex that was created and working in a previous version of Web Focus Developer Studio. I created a Save file that contains 9 records. I have 9 -READ statements to read each of the records. Now, the -READ keeps reading just the first record in the Save file. Pasted below is part of my code. Thanks.
Now, the -READ keeps reading just the first record in the Save file
Hi Michele,
From the above comment, is there any error following the first read or does it read first record nine times ? Can you clarify ?
Have you try to change the -READ for -READFILE instead ?
Have you think to not CLOSE the file after each READ ? I suspect that since it's closed the next READ just start from the beginning again and again.
Also have you ever think to change your code to something such as this ?
TABLE FILE &HLDMRS4
LIST REPORT_NETWORK_ID NETWORK_NAME
ON TABLE HOLD AS NETWRK
END
-RUN
-TYPE &LINES
-SET &LOOP = LJUST(10, &LINES, 'A10');
-SET &ID = 0;
-REPEAT READWRK &LOOP TIMES;
-READFILE NETWRK
-SET &ID = &ID + 1;
-SET &REC_CNT&ID.EVAL = EDIT(&REPORT_NETWORK_ID,'$$$$9');
-SET &NW_ID&ID.EVAL = EDIT(&NETWORK_NAME,'$$$$$$999999999');
-SET &NW_NAME&ID.EVAL = EDIT(&NETWORK_NAME,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &REC_CNT&ID.EVAL
-TYPE &NW_ID&ID.EVAL
-TYPE &NW_NAME&ID.EVAL
-RUN
-READWRK
-GOTO NETWORKS&LOOP.EVAL
-NETWORKS1
-TYPE A
-GOTO XEXIT
-NETWORKS2
-TYPE B
-GOTO XEXIT
-NETWORKS3
-TYPE C
-GOTO XEXIT
-NETWORKS4
-TYPE D
-GOTO XEXIT
-NETWORKS5
-TYPE E
-GOTO XEXIT
-NETWORKS6
-TYPE F
-GOTO XEXIT
-NETWORKS7
-TYPE G
-GOTO XEXIT
-NETWORKS8
-TYPE H
-GOTO XEXIT
-NETWORKS9
-TYPE I
-GOTO XEXIT
-NETWORKS10
-TYPE J
-GOTO XEXIT
-XEXIT
I don't get an error message. As I mentioned, this code was working fine in the 7.6 and 8009 releases. I will first try doing a -READFILE and eliminating the CLOSE statement. I'm trying to avoid doing a rewrite of my code because I have to change several fexes. Thanks.
You might want to open a case with IB tech support as well. It sounds like an upward compatibility issue and the workarounds you'll get here will only fix the immediate problem.
WebFOCUS 8206, Unix, Windows
Posts: 1853 | Location: New York City | Registered: December 30, 2015
You should be fine if you just remove the "-CLOSE &HLDMRS5" statement after all your -READs except for the last one. Seems like this is how it should have worked before. But I can't test that. Good luck.
WebFocus 8.201M, Windows, App Studio
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008
Thank you SO MUCH jfr99. Your suggestion worked perfectly. You are absolutely right when you stated that your suggestion is how it should have worked before. The later versions of WebFocus are allowing certain functions and statements to pass that perhaps should not have been allowed; only to create a problem in the version that follows.
I wanted to avoid a rewrite of my code, although the loop code that MartinY suggested does provide less coding. When I get time I may pursue that option.
Thanks again. You saved me from a lot of extra coding.
Martin, although jfr99's suggestion resolved my issue, I'd like to get the loop option that you suggested working for future use. In your code below, I need to revised the 3 -SET lines (-SET &REC_CNT&ID.EVAL, -SET &NW_ID&ID.EVAL, -SET &NW_NAME&ID.EVAL) that reads the hold file because those 3 -SET fields refer to the old way I was using the -READ. Pasted below is the mfd of the hold file. I need to know how to create 3 variables to use an &fieldnames to read each of the fields in the hold file. Thanks.
You can still use -READ and specify the parameters. As already mentioned, I'm surprised your code worked with the -CLOSE after every -READ - this makes every -READ start over, like you see in 8201.
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
Originally posted by Francis Mariani: You can still use -READ and specify the parameters. As already mentioned, I'm surprised your code worked with the -CLOSE after every -READ - this makes every -READ start over, like you see in 8201.
Cool. I thought I tried that and got an error message, but I can try again. Thanks.
I need to know how to create 3 variables to use an &fieldnames to read each of the fields in the hold file.
The good thing with READFILE vs READ is that READFILE automatically create a variable with the column's name (except if you've useD a AS) and takes care of the field format.
If you pay attention at my sample code the variables used in the -SET have the exact same name as in the master file.
But as I mentioned, you can also use your own variable's name such as this (but you will need a little more code)
SET ASNAMES = ON
-DEFAULTH &LST = ''
-DEFAULTH &NETID = ''
-DEFAULTH &NETNAME = ''
TABLE FILE &HLDMRS4
BY LIST AS 'LST'
BY REPORT_NETWORK_ID AS 'NETID'
BY NETWORK_NAME AS 'NETNAME'
ON TABLE HOLD AS NETWRK
END
-RUN
-TYPE &LINES
-SET &LOOP = LJUST(10, &LINES, 'A10');
-SET &ID = 0;
-REPEAT READWRK &LOOP TIMES;
-READFILE NETWRK
-SET &ID = &ID + 1;
-SET &REC_CNT&ID.EVAL = EDIT(&NETID,'$$$$9');
-SET &NW_ID&ID.EVAL = EDIT(&NETNAME,'$$$$$$999999999');
-SET &NW_NAME&ID.EVAL = EDIT(&NETNAME,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &REC_CNT&ID.EVAL
-TYPE &NW_ID&ID.EVAL
-TYPE &NW_NAME&ID.EVAL
-RUN
-READWRK
-GOTO NETWORKS&LOOP.EVAL
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
I need to know how to create 3 variables to use an &fieldnames to read each of the fields in the hold file.
The good thing with READFILE vs READ is that READFILE automatically create a variable with the column's name (except if you've useD a AS) and takes care of the field format.
If you pay attention at my sample code the variables used in the -SET have the exact same name as in the master file.
But as I mentioned, you can also use your own variable's name such as this (but you will need a little more code)
SET ASNAMES = ON
-DEFAULTH &LST = ''
-DEFAULTH &NETID = ''
-DEFAULTH &NETNAME = ''
TABLE FILE &HLDMRS4
BY LIST AS 'LST'
BY REPORT_NETWORK_ID AS 'NETID'
BY NETWORK_NAME AS 'NETNAME'
ON TABLE HOLD AS NETWRK
END
-RUN
-TYPE &LINES
-SET &LOOP = LJUST(10, &LINES, 'A10');
-SET &ID = 0;
-REPEAT READWRK &LOOP TIMES;
-READFILE NETWRK
-SET &ID = &ID + 1;
-SET &REC_CNT&ID.EVAL = EDIT(&NETID,'$$$$9');
-SET &NW_ID&ID.EVAL = EDIT(&NETNAME,'$$$$$$999999999');
-SET &NW_NAME&ID.EVAL = EDIT(&NETNAME,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &REC_CNT&ID.EVAL
-TYPE &NW_ID&ID.EVAL
-TYPE &NW_NAME&ID.EVAL
-RUN
-READWRK
-GOTO NETWORKS&LOOP.EVAL
Thanks so much Martin. I will definitely look into incorporating this loop logic in the near future, and use this sample loop logic in new projects as well. Thanks again for the sample code which helps makes suggestions easier to understand.