Jump to content

We are in need to getting the last update date of a file and...


Bob Rogers 2

Recommended Posts

We are in need to getting the last update date of a file and putting it on a web page. We have a page that monitors when processes are run and how many times they are run. Obtaining the last update date of a particular file would be very beneficial for monitoring this process. Any suggestions

Bob

Link to comment
Share on other sites

In WF you can use DOS command in a fex, just preceed the command with the key word : -DOS

Such as

-DOS dir /T E:ibiappsibisampcar.mas >E:ibiappsbaseappfile_date.txt

If you store than date in a file (as above), define a master for it you will then be able to read that date

FILEDEF FILE_DATE DISK E:ibiappsbaseappfile_date.txt

END

-RUN

 

TABLE FILE FILE_DATE

BY ...

END

-RUN

Link to comment
Share on other sites

Or if youre in Linux, you might use:

$ stat -c %y file1.txt

How to Get Last Modified Date of File in Linux

Also - beware of trying to watch a timestamp to tell you that a file is completely loaded.

For example, its possible that youll get a valid date on a file that youre FTPing with the idea of loading it into a database. If you are watching for the files date to change thinking it will indicate the file has arrived on your machine, you might want to be careful. If the file is open, the stats can be being updated and the FTP transfer will not have completed yet.

Just passing that one along from me messing that up in the past and kicking off a Bulk Copy too early before my file was done transferring to my server.

Link to comment
Share on other sites

I should point out here that many organizations have disabled the use of OS commands from inside of WebFOCUS- it provides a security hole that can be large, depending on what you are trying to protect. The best solution is to timestamp the table- that way the information is available to anyone who has access to the table, and there is no need for OS commands. Just my two bits.
Link to comment
Share on other sites

Hello Bob,

here is an example on how you can use the techniques described by all the great people before, and make them into a report output, that can then be displayed as a widget within your Portal.

The procedure also contains a few other techniques which may be helpful to you.

Output in this example is a WebFOCUS Report that displays a single text line with

Latest Update Date: {whatever your latest update date is}

Hope this helps

-* Step 1. Configure location of control file. The last update date of this file will be displayed on screen.

-* Add this procedure to a WebFOCUS Assembled Designer page.

-SET &MY_CONTROL_LOCATION=c:ibisrv82wfsetc;

-SET &MY_CONTROL_FILE=edasprof.prf;

-* Step 2. Virtual mapping to location, the control file is stored in.

APP MAP MY_CONTROL_LOCATION &MY_CONTROL_LOCATION

-RUN

-* Step 3. Use WebFOCUS APP QUERY function to read list of files and system information from application folder location (here the mapped application folder) into HOLD file nameed FOCAPPQ

APP QUERY MY_CONTROL_LOCATION HOLD

-RUN

-* Step 3b. (Optional for reference). Display contents of system info file FOCAPPQ

-* Uncomment the following 4 lines if contents need to be displayed for debugging.

-*TABLE FILE focappq

-*PRINT *

-END

--EIXT

-* Step 4. Filter to only display control file. Only display date

-* Rename DATE column and store results in HOLD file MYDATE.

-* HOLD file Will be used to read the value into a custom variable (here LATEST_UPDATE_DATE)

TABLE FILE focappq

PRINT DATE AS LATEST_UPDATE_DATE

WHERE FILENAME EQ &MY_CONTROL_FILE;

ON TABLE SET HOLDLIST PRINTONLY

ON TABLE SET ASNAMES ON

ON TABLE HOLD AS MYDATE FORMAT ALPHA

END

-RUN

-* Step 5. Read content of HOLD file and store results into WebFOCUS variables, here LATEST_UPDATE_DATE)

-* Use -READILE name_of_hold_file syntax

-* Dont forget to initialize the variables with DEFAULTH (default hidden, do not prompt)

-DEFAULTH &LATEST_UPDATE_DATE= ';

-READFILE MYDATE

-RUN

-TYPE LATEST_UPDATE_DATE is &LATEST_UPDATE_DATE

-* Step 6. Embed new variable LATEST_UPDATE_DATE into standard visualizaiton or report

-* Can use system table, a field needs to be referenced byt does not need to be displayed

-SET &ECHO=ON;

TABLE FILE systable

PRINT NAME NOPRINT

COMPUTE DISPLAY_DATE/A100=&LATEST_UPDATE_DATE; NOPRINT

COMPUTE BLANK/A1= '; AS

WHERE READLIMIT EQ 1

WHERE RECORDLIMIT EQ 1

ON TABLE SUBHEAD

Latest Update: <DISPLAY_DATE

ON TABLE SET PAGE NOPAGE

ON TABLE SET STYLE *

INCLUDE=IBFS:/WFC/Global/Themes/Standard/Default/theme.sty,$

TYPE=DATA,

BORDER-TOP=OFF,

BORDER-BOTTOM=OFF,

$

ENDSTYLE

END

-RUN

Link to comment
Share on other sites

For something exclusively FOCUS based, hows about the SYSAPPS synonym

TABLE FILE SYSAPPS

PRINT

FNAME AS File Name

FEXT AS File Extension

FDATE AS File Modification Date

FTIME AS File Modification Time

WHERE APPNAME EQ ibisamp

WHERE FNAME EQ car

END

The synonym itself should be in the home/catalog folder if you want to see all the fields.

Link to comment
Share on other sites

  • 2 months later...

When I worked for IBI you could find the last date and time a data file was updated from pseudo fields added to the synonym (if the underlying operating system provided it.) For example:

FIELDNAME=MOD_DATE, ALIAS=INSTANCE_DATE, USAGE=A10, ACTUAL=A10,$

FIELDNAME=MOD_TIME, ALIAS=INSTANCE_TIME, USAGE=A10, ACTUAL=A10, $

 

The ALIAS name must be as shown; the FIELDNAME is up to you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...