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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
&IORETURN
 Login/Join
 
Platinum Member
posted
Can anybody tell me how this variable works? I have been using it in one of my loops that reads a text file. I use it to loop until the end of my text file.

My guess is that when I set it equal to zero before the start of my loop then it stays that way for every record until there are no records left.


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Expert
posted Hide Post
You don't need to set the variable:

FILEDEF DMDCD DISK IBISAMP/DMDCD.FTM
-RUN

-SET &NB_LINES = 0;

-READ DMDCD &STID.A2 X1 &ST_NAME.A27.

-REPEAT ENDREP1 WHILE &IORETURN EQ 0;
-SET &NB_LINES = &NB_LINES + 1;
-TYPE &STID &ST_NAME
-READ DMDCD &STID.A2 X1 &ST_NAME.A27.
-ENDREP1

-TYPE &NB_LINES 


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
Platinum Member
posted Hide Post
If I don't set it, I get this error:

(FOC295) A VALUE IS MISSING FOR: &IORETURN


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Expert
posted Hide Post
The example I provided is a working one. I don't declare &IORETURN but it works. Probably because of the first READ, outside the loop.


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
Virtuoso
posted Hide Post
Mark

Francis is correct, and you should not need to SET &IORETURN, it is a system variable.

Do you want to post your code so that we can see what you are doing.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Mark,

The &IORETURN variable is an internal one and is primed in Francis' example by performing a READ operation before it is checked.

It is an old methology that is still stands today although from most posts it doesn;t seem to be put into practice. It is also the most logical way to process a file, in that you "read ahead", check the IO status, process the input, read the next line and then start again.

Read through Francis' example carefully, understand it and compare it to your process.

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
Platinum Member
posted Hide Post
The funny thing is that I modified my code when I looked at Francis' so that the -READ came before the -REPEAT statement (and took out the line that sets &IORETURN = 0) and it seemed to like that except I got an error saying that I didn't have enough virtual memory. Here is my original code:

FILEDEF SSN DISK "\\HORSEISLAND\NETSHARE\MEDICAL\OOQ\CLINICAL INFO MGMT\CMPROJECTS\OCCUPATIONAL HEALTH\WORKERSCOMP\SSN.TXT" (LRECL 9
-RUN
-SET &SSN=' ';
-SET &IORETURN = 0 ;
-REPEAT MYLOOP WHILE &IORETURN EQ 0 ;
-READ SSN NOCLOSE &SSN.A9.
TABLE FILE T2PERSON
...[a bunch of code]...
FILEDEF OUTPUT DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\OUTPUT.TXT (APPEND
TABLE FILE MYOUT
SUM BALANCE
BY PERSON_FIRST_NAME
BY PERSON_LAST_NAME
ON TABLE HOLD AS OUTPUT FORMAT COM
END
-MYLOOP
-EXIT


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
Virtuoso
posted Hide Post
Mark
Another way to work with &IORETURN:
FILEDEF SSN DISK "\\HORSEISLAND\NETSHARE\MEDICAL\OOQ\CLINICAL INFO MGMT\CMPROJECTS\OCCUPATIONAL HEALTH\WORKERSCOMP\SSN.TXT" (LRECL 9
FILEDEF OUTPUT DISK \\HORSEISLAND\NETSHARE\MEDICAL\OOQ\SOLUTIONSWORLD\WORLDS\MARK\WORK\FEB07\OUTPUT.TXT (APPEND
-RUN
-SET &SSN=' ';
-REPEAT MYLOOP 99999 TIMES
-READ SSN NOCLOSE &SSN.A9.
-IF &IORETURN NE 0 GOTO OUTLOOP;
TABLE FILE T2PERSON
...[a bunch of code]...
TABLE FILE MYOUT
SUM BALANCE
BY PERSON_FIRST_NAME
BY PERSON_LAST_NAME
ON TABLE HOLD AS OUTPUT FORMAT COM
END
-RUN
-MYLOOP
-OUTLOOP
-EXIT

Also you shouldn't need to keep the OUTPUT FILEDEF in the loop, and a RUN in between so that FOCSTACK doesn't get too big. So &IORETURN doesn't need priming as Tony says, because the READ does the priming for you.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Cool!!! Thanks to all who responded. This is great!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders