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]WF 8.2 App Studio -READ

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]WF 8.2 App Studio -READ
 Login/Join
 
Guru
posted
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.

TABLE FILE &HLDMRS4
LIST REPORT_NETWORK_ID NETWORK_NAME
ON TABLE SAVE AS &HLDMRS5
END
-RUN

-TYPE &LINES

-READ &HLDMRS5 &RECORD_COUNT1.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT1 = EDIT(&RECORD_COUNT1,'$$$$9');
-SET &NW_ID1   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME1 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT1
-TYPE &NW_ID1
-TYPE &NW_NAME1
-*
-IF &REC_CNT1 EQ &LINES GOTO NETWORKS1 ELSE GOTO READ2;
-READ2
-READ &HLDMRS5 &RECORD_COUNT2.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT2 = EDIT(&RECORD_COUNT2,'$$$$9');
-SET &NW_ID2   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME2 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT2
-TYPE &NW_ID2
-TYPE &NW_NAME2
-*
-IF &REC_CNT2 EQ &LINES GOTO NETWORKS2 ELSE GOTO READ3;
-READ3
-READ &HLDMRS5 &RECORD_COUNT3.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT3 = EDIT(&RECORD_COUNT3,'$$$$9');
-SET &NW_ID3   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME3 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT3
-TYPE &NW_ID3
-TYPE &NW_NAME3
-*
-IF &REC_CNT3 EQ &LINES GOTO NETWORKS3 ELSE GOTO READ4;
-READ4
-READ &HLDMRS5 &RECORD_COUNT4.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT4 = EDIT(&RECORD_COUNT4,'$$$$9');
-SET &NW_ID4   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME4 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT4
-TYPE &NW_ID4
-TYPE &NW_NAME4
-*
-IF &REC_CNT4 EQ &LINES GOTO NETWORKS4 ELSE GOTO READ5;
-READ5
-READ &HLDMRS5 &RECORD_COUNT5.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT5 = EDIT(&RECORD_COUNT5,'$$$$9');
-SET &NW_ID5   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME5 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT5
-TYPE &NW_ID5
-TYPE &NW_NAME5
-*
-IF &REC_CNT5 EQ &LINES GOTO NETWORKS5 ELSE GOTO READ6;
-READ6
-READ &HLDMRS5 &RECORD_COUNT6.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT6 = EDIT(&RECORD_COUNT6,'$$$$9');
-SET &NW_ID6   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME6 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT6
-TYPE &NW_ID6
-TYPE &NW_NAME6
-*
-IF &REC_CNT6 EQ &LINES GOTO NETWORKS6 ELSE GOTO READ7;
-READ7
-READ &HLDMRS5 &RECORD_COUNT7.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT7 = EDIT(&RECORD_COUNT7,'$$$$9');
-SET &NW_ID7   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME7 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT7
-TYPE &NW_ID7
-TYPE &NW_NAME7
-*
-IF &REC_CNT7 EQ &LINES GOTO NETWORKS7 ELSE GOTO READ8;
-READ8
-READ &HLDMRS5 &RECORD_COUNT8.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT8 = EDIT(&RECORD_COUNT8,'$$$$9');
-SET &NW_ID8   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME8 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT8
-TYPE &NW_ID8
-TYPE &NW_NAME8
-*
-IF &REC_CNT8 EQ &LINES GOTO NETWORKS8 ELSE GOTO READ9;
-READ9
-READ &HLDMRS5 &RECORD_COUNT9.I5. &NETWRK_DATA.A71.
-CLOSE &HLDMRS5
-SET &REC_CNT9 = EDIT(&RECORD_COUNT9,'$$$$9');
-SET &NW_ID9   = EDIT(&NETWRK_DATA,'$$$$$$999999999');
-SET &NW_NAME9 = EDIT(&NETWRK_DATA,'$$$$$$$$$$$$$$$$$$$$$99999999999999999999999999999999999');
-TYPE &RECORD_COUNT9
-TYPE &NW_ID9
-TYPE &NW_NAME9

  

This message has been edited. Last edited by: Michele Brooks,


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
quote:
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


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, 2013Report This Post
Virtuoso
posted Hide Post
What release of WebFOCUS did you upgrade from?


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Guru
posted Hide Post
Upgraded from 8009. Thanks.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Guru
posted Hide Post
quote:
Originally posted by MartinY:
quote:
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.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
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, 2015Report This Post
Platinum Member
posted Hide Post
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, 2008Report This Post
Guru
posted Hide Post
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.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Guru
posted Hide Post
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.

  
FIELDNAME=LIST, ALIAS=E01, USAGE=I5, ACTUAL=I04, $		
    FIELDNAME=REPORT_NETWORK_ID, ALIAS=E02, USAGE=A9V, ACTUAL=A10V, $		
    FIELDNAME=NETWORK_NAME, ALIAS=E03, USAGE=A50V, ACTUAL=A50V, $		




-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
  


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Expert
posted Hide Post
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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
quote:
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.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
quote:
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, 2013Report This Post
Guru
posted Hide Post
quote:
Originally posted by MartinY:
quote:
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.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report 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]WF 8.2 App Studio -READ

Copyright © 1996-2020 Information Builders