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've ran into an issue where we have multiple CHECK FILE to ensure a file exists in FOCCACHE before we read from them and &LINES and &RECORDS are coming back with the previous information, not the current one.
We have tried to -SET &LINES = _FOC_NULL; it errors. We have tried to -SET &LINES = 0; and even if the file exists, its still 0 when check file is executed.
Anyone run into this issue? How did you get around it?
You will noticed, I'm creating the first FOCCACHE file, but MYTABLE2 is never created, but it will return a results, saying there are 18 lines and records within it, from the CHECK FILE FOCCACHE/MYTABLE2
Here is the code I have:
SET ASNAMES = ON
TABLE FILE CAR
PRINT
CAR.ORIGIN.COUNTRY AS 'COUNTRY'
CAR.COMP.CAR AS 'CAR'
CAR.CARREC.MODEL AS 'MODEL'
CAR.BODY.SALES AS 'SALES'
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS FOCCACHE/MYCAR FORMAT XFOCUS
END
-RUN
CHECK FILE FOCCACHE/MYCAR
-RUN
-TYPE LINES1 = &LINES;
-TYPE RECORDS1 = &RECORDS;
-IF &LINES EQ 0 THEN GOTO MISSINGDATA;
TABLE FILE FOCCACHE/MYCAR
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS SEARCHMYTABLE1 FORMAT INTERNAL
END
-RUN
-READFILE SEARCHMYTABLE1
-RUN
CHECK FILE FOCCACHE/MYTABLE2
-RUN
-TYPE LINES2 = &LINES;
-TYPE RECORDS2 = &RECORDS;
-IF &LINES EQ 0 THEN GOTO MISSINGDATA;
TABLE FILE FOCCACHE/MYTABLE2
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS SEARCHMYTABLE2 FORMAT INTERNAL
END
-RUN
-READFILE SEARCHMYTABLE2
-RUN
-GOTO THEEND
-MISSINGDATA
-TYPE Missing Data here..
-THEEND
-TYPE Ended
Results:
0 NUMBER OF RECORDS IN TABLE= 18 LINES= 18
0 NUMBER OF ERRORS= 0
NUMBER OF SEGMENTS= 1 ( REAL= 1 VIRTUAL= 0 )
NUMBER OF FIELDS= 5 INDEXES= 0 FILES= 1
TOTAL LENGTH OF ALL FIELDS= 61
LINES1 = 5;
RECORDS1 = 1;
0 NUMBER OF RECORDS IN TABLE= 18 LINES= 18
0 ERROR AT OR NEAR LINE 32 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: FOCCACHE/MYTABLE2
LINES2 = 18;
RECORDS2 = 18;
0 ERROR AT OR NEAR LINE 38 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: FOCCACHE/MYTABLE2
BYPASSING TO END OF COMMAND
Ended
This message has been edited. Last edited by: GavinL,
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server
I agree, CHECK FILE on a non-existent file should set &LINES and &RECORDS to zero, but doesn't. A work-around is to use a TABLE request that returns zero records:
CHECK FILE CAR
-RUN
-TYPE &RECORDS
-TYPE &LINES
-*
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ 'MEXICO';
END
-RUN
-TYPE &RECORDS
-TYPE &LINES
-*
CHECK FILE XYZ
-RUN
-TYPE &RECORDS
-TYPE &LINES
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
You may be able to use the STATE command to check for the existence of a file. A return code of zero means the file exists. A return code of -1 means it doesn't.
DOS STATE FOCCACHE/MYCAR.FOC
-RUN
-TYPE &RETCODE
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Actually, I've made a discovery.. &RETCODE seems to be set for CHECK FILE. If the file exists, it's 0, if it doesn't I'm getting 8. I'm not sure what 8 means, but it seems to be consistent. Though HELP doesn't say anything about &RETCODE for CHECK FILE. My problem with using STATE was, our dev environment is Windows and our Prod environment is LINUX, so our FOCCACHE folder could be in different locations per environment. I didn't want to create a DB, just to store location of FOCCACHE and I can't do a STATE 'FOCCACHE/MYCAR.foc' as STATE thinks FOCCACHE is under the reporting server approot, which it isn't.
I'll play with &RETCODE for FILE CHECK a bit more to see if I see any flux.
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server
My IBI rep responded, that CHECK FILE isn't supposed to be used to validate file existence, it's only to validate the MASTER FILE, which I responded, if the validation fails, how does one know since HELP doesn't state it anywhere.
This seems to be working. Always 0 if the file exists and 8 if it doesn't exist. I think this might work.
-DEFAULT &RETCODE = _FOC_NULL;
SET ASNAMES = ON
TABLE FILE CAR
PRINT
CAR.ORIGIN.COUNTRY AS 'COUNTRY'
CAR.COMP.CAR AS 'CAR'
CAR.CARREC.MODEL AS 'MODEL'
CAR.BODY.SALES AS 'SALES'
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS FOCCACHE/MYCAR FORMAT XFOCUS
END
-RUN
CHECK FILE FOCCACHE/MYCAR
-RUN
-TYPE RETCODE = &RETCODE;
-IF &RETCODE NE 0 THEN GOTO MISSINGDATA;
TABLE FILE FOCCACHE/MYCAR
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS SEARCHMYTABLE1 FORMAT INTERNAL
END
-RUN
-TYPE RETCODE2 = &RETCODE;
CHECK FILE FOCCACHE/MYCAR
-RUN
-TYPE RETCODE3 = &RETCODE;
TABLE FILE FOCCACHE/MYCAR
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS SEARCHMYTABLE2 FORMAT INTERNAL
END
-TYPE RETCODE4 = &RETCODE;
-RUN
CHECK FILE FOCCACHE/MYTABLE2
-RUN
-TYPE RETCODE5 = &RETCODE;
-IF &RETCODE NE 0 THEN GOTO MISSINGDATA;
TABLE FILE FOCCACHE/MYTABLE2
PRINT *
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE HOLD AS SEARCHMYTABLE2 FORMAT INTERNAL
END
-RUN
-READFILE SEARCHMYTABLE1
-RUN
-READFILE SEARCHMYTABLE2
-RUN
-GOTO THEEND
-MISSINGDATA
-TYPE Missing Data here..
-THEEND
-TYPE Ended
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server
&RETCODE Value Equivalent FOCUS Code/Message 0 (FOC488) Dataset is in catalog: 4 (FOC489) Dataset is in catalog, but not on volume indicated: 8 (FOC490) Dataset is not in catalog
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server
Gavin, this may not help you, but this is how I check for the existence of a file in FOCCACHE:
-* test if the previously created file is found in foccache
APP QUERY foccache HOLD
-RUN
-INCLUDE common/util_check_error.fex
TABLEF FILE FOCAPPQ
PRINT
FILENAME
WHERE FILENAME EQ 'hsearch_security_&P_RUN_ID...ftm'
ON TABLE SAVE
END
-RUN
-INCLUDE common/util_check_error.fex
-SET &P_FILE_EXIST = &LINES;
-* if the file is not found in foccache, create the file
-SET &P_FILE_STATUS = IF &P_FILE_EXIST GT 0 THEN 'file in foccache' ELSE '';
-IF &P_FILE_EXIST GT 0 GOTO CREATE_FILTERS;
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