Focal Point
[CLOSED] How to clear foccache directory from FOCUS?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3157085136

June 19, 2013, 07:31 AM
Wep5622
[CLOSED] How to clear foccache directory from FOCUS?
We have a number of procedures that are started after each other as tasks in the same ReportCaster schedule. Each task accumulates quite a bit of data in the foccache directory for that session, which regularly results in our server running out of disk space (and abort the RC job).

We have just over 20GB of free disk space right now. Apparently our nightly jobs manage to fill that up temporarily, until the foccaches are cleared again after 3 hours.
We can't really reduce that time, because some RC tasks require that much time to complete, so we are wondering whether it's possible to explicitly clear the foccache of the reportcaster session when we know there's nothing in there that we still need.

Is there such a command?

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
June 19, 2013, 07:45 AM
linnex
Hi,

dunno if this helps but I use the following code to determine the current foccache path for the current agent:

-* *********************
-* * Returns the path to current foccache folder in
-* * &FOCCACHE_PATH
-* * -> if empty then function failed
-* *********************

-SET &FOC_HOLD_NAME = 'FCHOLD_NEVER_USED';

-SET &FOCCACHE_PATH = '';
-SET &FOCCACHE_FILEPATH = '';

TABLE FILE CAR
PRINT CAR
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS FOCCACHE/&FOC_HOLD_NAME FORMAT ALPHA
END
-RUN

TABLE FILE SYSFILES
PRINT
  COMPUTE PATH/A1024 = PHNAME;
WHERE FILENAME EQ LOCASE(&FOC_HOLD_NAME.LENGTH, &FOC_HOLD_NAME.QUOTEDSTRING, 'A200');
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS H_FOCPATH FORMAT ALPHA
END
-RUN
-IF &LINES EQ 0 THEN GOTO L_ERROR;
-READ H_FOCPATH &FOCCACHE_FILEPATH.A1024.
-SET &FOCCACHE_FILEPATH = TRUNCATE(&FOCCACHE_FILEPATH);

-* extract filename & remove
-SET &PATH_FILEPART1 = GETTOK(&FOCCACHE_FILEPATH.QUOTEDSTRING, &FOCCACHE_FILEPATH.LENGTH, -1, '\\', 1024, 'A1024');
-SET &PATH_FILEPART1 = TRUNCATE(&PATH_FILEPART1);
-SET &PATH_FILEPART2 = GETTOK(&FOCCACHE_FILEPATH.QUOTEDSTRING, &FOCCACHE_FILEPATH.LENGTH, -1, '/', 1024, 'A1024');
-SET &PATH_FILEPART2 = TRUNCATE(&PATH_FILEPART2);

-SET &PATH_FILEPART =
-   IF &PATH_FILEPART1.LENGTH EQ 0 THEN &PATH_FILEPART2.QUOTEDSTRING
-   ELSE IF &PATH_FILEPART2.LENGTH EQ 0 THEN &PATH_FILEPART1.QUOTEDSTRING
-   ELSE IF &PATH_FILEPART2.LENGTH LT &PATH_FILEPART1.LENGTH THEN &PATH_FILEPART2.QUOTEDSTRING
-   ELSE &PATH_FILEPART1.QUOTEDSTRING;

-SET &FOCCACHE_PATH = SUBSTR(&FOCCACHE_FILEPATH.LENGTH, &FOCCACHE_FILEPATH.QUOTEDSTRING, 1, &FOCCACHE_FILEPATH.LENGTH - &PATH_FILEPART.LENGTH, &FOCCACHE_FILEPATH.LENGTH - &PATH_FILEPART.LENGTH, 'A1024');
-SET &FOCCACHE_PATH = TRUNCATE(&FOCCACHE_PATH);

-L_ERROR


You could afterwards just "-DOS del &FOCCACHE_PATH|\*.*" or something.


WebFOCUS 7.7.03
June 19, 2013, 09:34 AM
njsden
Good One

I took the liberty to simplify the logic a bit but the concept is exactly the same. I will definitely take advantage of such a pretty neat technique, linnex. Thanks.

-SET &FOC_HOLD_NAME    = 'FCHOLD_NEVER_USED';

-SET &FOC_HOLD_NAME_LC = LOCASE(&FOC_HOLD_NAME.LENGTH, &FOC_HOLD_NAME.QUOTEDSTRING, 'A&FOC_HOLD_NAME');
-* Change '\' below to '/' or any directory delimiter used by the OS where EDASERVE runs
-SET &FOC_FILE_NAME    = '\' || &FOC_HOLD_NAME_LC || '.mas';

-SET &FOCCACHE_PATH     = '';

TABLE FILE CAR
PRINT CAR
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS FOCCACHE/&FOC_HOLD_NAME FORMAT ALPHA
END
-RUN

TABLE FILE SYSFILES
PRINT
        COMPUTE FOCCACHE_PATH/A80 = STRREP(80, PHNAME, &FOC_FILE_NAME.LENGTH, &FOC_FILE_NAME.QUOTEDSTRING, 0, '', 80, FOCCACHE_PATH);
WHERE FILENAME EQ &FOC_HOLD_NAME_LC.QUOTEDSTRING;
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS H_FOCPATH FORMAT ALPHA
END
-RUN
-IF &LINES EQ 0 THEN GOTO L_ERROR;

-READFILE H_FOCPATH
-SET &FOCCACHE_PATH = TRUNCATE(&FOCCACHE_PATH);
-TYPE FOCCACHE_PATH -> &FOCCACHE_PATH

-L_ERROR




Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
June 19, 2013, 05:54 PM
Waz
Do you need to put all this stuff in foccache ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 20, 2013, 08:21 AM
Doug
Good point Waz, If this is all session based information, then it's available during the session without APP HOLDing to foccache, right?.
quote:
Each task accumulates quite a bit of data in the foccache directory for that session.

June 20, 2013, 11:01 AM
Wep5622
You do have a point there. I'll check the results tomorrow when the RC job has run.

BTW, we AVOID using APP HOLD in (recent) reports. We use explicit paths to write our hold files to, such as:
ON TABLE HOLD AS MYAPP/MYHOLD FORMAT FOCUS
. We do the same for files that we write to FOCCACHE.

We found that APP HOLD was causing more problems than it solved. A scenario that we're too familiar with:

The above scenario happens too easy if you have long warehouse-loading procedures that have been modified over time. It's too easy to miss a single APP HOLD statement several screens up in the code and accidentally write data that is supposed to be temporary (and possibly user specific) to the project directory instead of the session.


The annoying thing is that hold files that you need in launch pages, often user-specific, need to be in the app path to allow HTMLComposer to find them. The silly bugger is NOT looking in FOCCACHE for some reason and you can't add that directory to the path unless you put your foccache among your project directories (eeew!)...
We frequently end up writing a quick hold-file to our project directory so that HTMLComposer has something to work with and then remove that again as soon as the launch page works. Oh, and of course you need to modify all instances of ibiapp_app="aaa bbb ccc etc" in the HTML to include the foccache directory!


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
June 20, 2013, 11:07 AM
Mighty Max
I am guessing you are doing data extracts. If you are creating multiple intermediate hold files within a report caster job.
You could overwrite them when they are no longer needed to free up disk space. Used this on a project when we were having disk space issues.

-* Determine the edatemp folder of the agent
-SET &TEMP_PATH_X = TEMPPATH(1000,'A1000');
-SET &TEMP_PATH   = TRUNCATE(&TEMP_PATH_X);


TABLE FILE CAR
PRINT
   CAR
   COUNTRY
   MODEL
ON TABLE HOLD AS H1 FORMAT ALPHA
END
-RUN


TABLE FILE H1
PRINT
   COUNTRY
ON TABLE HOLD AS H2 FORMAT ALPHA
END
-RUN



-* Clean up H1 we no longer need it.
-* This can be made into an EXEC routine.

-SET &HOLD_FORMAT = 'ALPHA'; 
-SET &HOLD_FILE   = 'H1';

-* Map to agent folder so we can store our new hold file there
APP MAP agent_folder &TEMP_PATH
-RUN
 
-* Set APP HOLD
APP HOLD agent_folder
-RUN
 
-* Overwrite the hold file in the agent folder
TABLE FILE CAR
PRINT
   CAR
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS &HOLD_FILE FORMAT &HOLD_FORMAT
END
-RUN
 
-* Clear APP HOLD
APP HOLD
-RUN



WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files