April 10, 2008, 04:44 PM
IBForumReturning 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.
April 10, 2008, 05:15 PM
FrankDutchYou 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.
April 10, 2008, 05:20 PM
Francis MarianiHere's a response from Tony:
check timestamp on fileWith 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.
April 10, 2008, 05:24 PM
FrankDutchThere is also a way to read the creation date and the last modification date. I have to look it up at the office.
April 10, 2008, 06:55 PM
IBForumThanks, 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.
April 10, 2008, 08:15 PM
Alan BThe 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.
April 10, 2008, 11:01 PM
WazIf 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.
April 11, 2008, 09:47 AM
Chuck-n-ChargeThere 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