2007 Dec 21 6:45 PM
hi
I am doing a program , where requirment is that a excel file will be provided to me either from a desktop , or from application server .
so i need to check in the selection screen as to which option is clicked and accordingly take the file from there.
my question is however that everytime the program is executed , i need to develop logic so that i should CHECK if the file on application server is a NEW file , as compared to the last time the program was executed. If its NOT a NEW file the program should no make any changes.
how can i check that ? any ideas
plase help.
2007 Dec 21 7:26 PM
Read one file using OPEN DATASET.... READ DATASET...etc into an internal Table - ZTab1
Read the other file using OPEN DATASET.... READ DATASET...etc into an internal Table - ZTab2
Then compare them with this:
if ZTab1[] ne ZTab2[].
the files are NOT the same - so do something
endif.
2007 Dec 21 8:57 PM
You can do such checks only if you have your old file as well as your new file or you have your old file records keys and you can compare it to your new record file record keys. It is a good practice to archive the input file to a different directory or rename it once it is processed. Please take that approach instead of trying to compare old and new.
2007 Dec 22 7:34 AM
Hi A_99,
There are many ways to what you want, but most people don't bother, the user has to use a little grey matter (brains) when running the program. You can always screw up somehow.
On the application server, with regular running batch jobs, you would have an input directory where files are placed for reading from a program. When the program is done, you would have a another process to remove from the directory and delete it or, timestamp it and save it in a backup directory. In case you ever needed to rerun, or check the file, it would be there.
You could write the process within your program to delete and move to another directory but typically it's done by UNIX scripts or by a job scheduler that has that capability.
You can on the desktop do something similar but again the user should take some responsibility in knowing which file to run and from where. If they are running online and using the frontend (local c: drive),
one way, don't default the filename so that they always have to manually select the file name. Have the user date all the files they use and read. This is not a programming issue but a process issue.
If you were running the program once a day for example you could create a table so that it every time you run the program it will save the date, time, userid, filename, program name, so that each time you run the porgram it will first check to see if its run that day or not. But it's elaborate and I can't think of that many cases where you need to do that.
Many ways, pick the easy to do, it's usually the right way.
Hope this helps.
Filler