Retrieving timestamp from a flat file

raiym

Active Member
Hi group,
I was wondering if anybody has any idea on how I would be able to complare two flat files and see if they are the same or not. I know the name of the files but I was wondering if there was a way to get maybe the time stamp and compare the two or if there was any other method to do the same.

Appreciate the help I get to each and every post of mine.
Yathindra
XE Update 4 SP 16.1 AS/400 Win 2000
 
Yathindra,

Here is a silly hint for you.

Create a new Business Function and pass the full filenames to it as input and get back the results.
Inside the BSFN open both file and read both file line by line and compare the lines with a simple IF statement.
If one line is different or either file terminates earlier than they are different.
Close both file on the end of the BSFN.

I suppose, it is not too hard and large job to develop it.

Please, keep us informed. Thanks!

Good luck,

Zoltán

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
One of the tools in the visual C++ toolkit is called Windiff. It is a
utility used to compare two files (usually used for source code
comparisons) and highlights the differences between the two. Since C++
puts its path into your environmental variables, just do a
start/run/windiff and it should open..

John

----------------------------------------------------------
OneWorld Xe (B733.3)
Update 2, SP 16
Oneoffs: SP16_011, _018, _019
Running on: NT4/SP6a, SQL7/SP3
Windows TS/Metaframe 1.8
----------------------------------------------------------






Xe, Update2, SP16
NT/SP6a, SQL7/SP3, WTS/Metaframe 1.8
 
Zoltan,
Thank you for the tip. That is a great way to do it. The only thing is that I am short on time and wanted to find out if I could just get a timestamp using maybe a business function already existing and thus compare the two. Moreover I am concerned about the file size being too large and using too much processing time.

Yathindra
XE Update 4 SP 16.1 As/400 Win 2000
 
Hi Yathindra,

Currently I don't know any BSFN wich returns with the file size and timestamp. Of course, it doesn't mean that there isn't any.

A possible solution could be calling an external (Operating System Level) script or batch file which produce a list about the directory entries of the file into a text file(s) and reading this text file(s) and compare the contents of them.

This solution in detailes, depends on where do your flat files reside and on the operating system too.

Can this work for you?

Other hint.
If you have to make this check very frequently then:
1.) Create a custom work table where the primary index is the file name.
Time To Time:
2.) Create the directory entry list.
3.) Delete the contents of the work table.
4.) Read through the list and fill your work table (e.g. extract the file names and any other parameters and place them into separate fields).
5.) Create your analysis logic based on the contents of the work table.

Of course, you can modify and extend this suggested solution based on your needs.

Please, keep us informed! Thanks.

Good luck,

Zoltán

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Back
Top