Focal Point
[CODE] Retrieving file object attributes

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

February 10, 2010, 12:54 PM
knegrotto
[CODE] Retrieving file object attributes
Cool
I had a need to find out the date a reporting file was last updated.

I cobbled this solution together from posts on this forum and the user manuals and thought it might just help someone else.

It uses APP QUERY to dump a directory listing into system table FOCAPPQ which is defined in WebFocus.

I then queried the table to select the file I wanted and stored the date in a hold file which I then read.

Here is the sample code.

SET PCOMMA=ON
SET ALL=ON
APP QUERY CLECO_TEMP HOLD
TABLE FILE FOCAPPQ
WHERE FILENAME EQ 'IBIMRUSR.TXT' OR FILENAME EQ 'ibimrusr.txt'
PRINT DATE
ON TABLE SAVE AS FILEINFO FORMAT ALPHA
END
-RUN
-SET &TEXTDATE = 'NOT FOUND';
-READ FILEINFO, &TEXTDATE
-RUN

Other file attributes are also available (see definition of the FOCAPPQ table fo list).

I hope someone finds this useful!

This message has been edited. Last edited by: knegrotto,


WebFOCUS 769
Windows
all
February 10, 2010, 01:49 PM
Dan Satchell
Good One


WebFOCUS 7.7.05
February 10, 2010, 01:55 PM
njsden
Wow! Cool tip. Thanks for sharing it knegrotto!



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.
February 10, 2010, 02:39 PM
Darin Lee
Great job!
We do something almost identical for an automated process that we have. An external customer sends us a file via FTP once a quarter. We never know exactly when it's going to come so we just have an automatic script that takes the ftp'ed file when it arrives, decrypts it using a private key and moves it to the location where the WF server can access it.

In order for the user to know whether they have the most current file, I wrote a very similar procedure that the user can run any time after the quarter end to see if the customer has submitted the latest required file.
SET HOLDLIST=PRINTONLY
APP QUERY FLATFILES HOLD
-RUN
DEFINE FILE FOCAPPQ
DATE_DMYY/A8DMYY=EDIT(DATE,'99$99$9999');
FDATE/MtrDYY=DATE_DMYY;
END
TABLE FILE FOCAPPQ
PRINT FILENAME/A12 SIZE FDATE AS 'DATE' TIME
WHERE FILENAME EQ 'filename.ftm';
END


Then they don't have to keep calling us to see when the new file will be available.

This message has been edited. Last edited by: Darin Lee,


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
February 10, 2010, 02:53 PM
njsden
Well Darin, you've just given me a great idea to brush off ... I mean, to give business users more independence! Music



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.