Focal Point
Returning a File Date

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

April 10, 2008, 04:44 PM
IBForum
Returning a File Date
Is there a function in WebFOCUS to return a file's timestamp? I'd like to compare FOC files from 2 different days using a WF report and in my heading I'd like to show the last modification date of each corresponding FOC file. Thanks in advance for your help.


WF 8.1.05, Windows Server 2012 R2
April 10, 2008, 05:15 PM
FrankDutch
You can do something like we did with the FEX files.

With some dos commands you can put all the file names in an text file with the date and time stamp.
Then you create a master that describes this text file. next step is create a report.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 10, 2008, 05:20 PM
Francis Mariani
Here's a response from Tony: check timestamp on file

With a couple of small modifications, here's the code he suggested:

-SET &ECHO=ALL;

DOS CD D:/ibi/apps/ibisamp
DOS DIR car.mas /TC > D:/ibi/temp/tempfile.txt
FILEDEF tempfile DISK D:/ibi/temp/tempfile.txt
-RUN

-*-- bypass header lines
-REPEAT endLoop 3 TIMES;
-READ tempfile &x.A10.
-endLoop

-*-- read file info
-READ tempfile &x.A1. &FileDate.A10. &x.A2. &FileTime.A8.

-TYPE &FileDate &FileTime
-RUN

This will give you the date and time in Dialogue Manager variables.

Strangely, the command
? FILE CAR

Gives me a different date/time, newer than the DOS update date/time.


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
April 10, 2008, 05:24 PM
FrankDutch
There is also a way to read the creation date and the last modification date. I have to look it up at the office.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 10, 2008, 06:55 PM
IBForum
Thanks, I was going to try some embedded JavaScript, but this seems more straightforward.

Francis, you are definitely better at searching the Forum for solutions than I am.


WF 8.1.05, Windows Server 2012 R2
April 10, 2008, 08:15 PM
Alan B
The most accurate approach is to use AUTODATE in the FOCUS db. This can be applied to each segment and gives the most accurate data, particularly if using FDS. Have used it for couple of years now, it is simple to use and report from.


Alan.
WF 7.705/8.007
April 10, 2008, 11:01 PM
Waz
If you know which directory the Foc file is in, you could use the APP command.

APP QUERY IBISAMP HOLD
TABLE FILE FOCAPPQ
PRINT *
END


The benefit to this is that it will work on other platforms, say Unix, and is all done in WebFOCUS code, not OS calls.


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!

April 11, 2008, 09:47 AM
Chuck-n-Charge
There is a 18 char limititaion on the use of APP QUERY and it does not work on a folder with a space int the name, so what you have to do is create a MAP then APP QUERY to the PATH you created.
I use APP QUERY to check about 100 files & folders then create a database of this output then 24 hrs later run another APP QUERY that compares the old data base to the new data and if any changes was made on date or time due to an update the file will show on an my reports

APP MAP CAT E:\ibi\srv71\home\catalog
APP PATH CAT
APP QUERY CAT HOLD

APP HOLD AUDIT_CHECK
FILEDEF CATALOG1 DISK E:\AUDIT_CHECK\CATALOG1.DAT

DEFINE FILE FOCAPPQ
FILETYPE/A3=GETTOK(FILENAME,70,2,'.',3,'A3');
RMSL/A8=EDIT (DATE, '99$99$9999');
READDATE/YYMD=DATECVT(RMSL,'A8DMYY','YYMD');
FOLDER1/A18 = 'E:\IBI\SRV71\HOME\';
FOLDER2/A60 = FOLDER1|APPNAME;
FILENAME/A70=UPCASE(70, FILENAME, 'A70');
APPNAME/A18=UPCASE(18, APPNAME, 'A18');
-*FOLDER2/A79 = FOLDER|FILENAME;
-*< TO CREATE THE FOLDER LIST/FILENAME SO THEY COULD BE COPIED AND PASTED IN THE REPORT
TODAY/MDYY = &MDYY
END

TABLE FILE FOCAPPQ
-*WHERE FILENAME CONTAINS '.fex' OR '.FEX'

WHERE FILENAME CONTAINS '.'

-*WHERE FILENAME OMITS '.'
-*< TO PULL THE FOLDER NAMES SO THEY COULD BE COPIED AND PASTED IN THE REPORT FROM EXCEL OUTPUT

PRINT
FILENAME
READDATE AS 'ORG_DATE'
TIME AS 'ORG_TIME'
SIZE AS 'ORG_SIZE'
FOLDER2 AS 'ORG_LOCATION'
TODAY AS 'OLD_TODAY'
AND COMPUTE

NOWTIME/A8 = HHMMSS(NOWTIME); AS 'OLD_NOWTIME'
ON TABLE HOLD AS CATALOG1 FORMAT ALPHA
-*ON TABLE PCHOLD FORMAT EXL2K
END

after a match of old and new i compare the 2 database for a change

COMPUTE
CHANGED/I1 = IF ORG_DATE NE NEW_DATE THEN 1 ELSE
IF ORG_TIME NE NEW_TIME THEN 2 ELSE 0;

HEAD_TIME/A8 = IF ORG_DATE EQ ' ' THEN LAST OLD_NOWTIME ELSE OLD_NOWTIME;
HEAD_DATE/MDYY = IF ORG_DATE EQ ' ' THEN LAST OLD_TODAY ELSE OLD_TODAY;
CUR_DATE/MDYY = &MDYY;
NOWTIME2/A8 = HHMMSS(NOWTIME); NOPRINT

WHERE TOTAL CHANGED EQ '1' OR '2'

BY FILENAME NOPRINT
ON TABLE HOLD AS HOLD2 FORMAT ALPHA
END


DEFINE FILE HOLD2
-* -1 counts from right to left at end, anything ge to 0 counts from left to right the number of beganning
FILETYPE/A3=GETTOK(FILENAME,70,-1,'.',3,'A3');
END

Chuck




Prod: WebFOCUS 7.1, 7.13, 7.6
Test: DevStudio 7.1, 7.6 Servlet - Self Service - MS Windows XP SP2 - Apache Tomcat 5.0.28
Output: HTML, Excel 2000 and PDF