View previous topic :: View next topic
|
Author |
Message |
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
Hi Guys,
How can I find the LAST edited timestamp of a PS file through REXX code?
Please help.
Thanks and Regards. |
|
Back to top |
|
|
David Robinson
Active User
Joined: 21 Dec 2011 Posts: 199 Location: UK
|
|
|
|
As has been mentioned on here countless times before, the only way to get this information is to extract it from SMF.
I would suggest that the type 15 records would be a good place to start. |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
HI David,
I did not get anything from the post. Request you to please elaborate a bit. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Since we generally don't go around editing plane PS files, we don't miss the inability to access a timestamp for it.
If you want to access said "timestamp" there only way you can do it is through accessing the SMF audit records (which you may not have permission to do).
As David said.
What are you trying to achieve, rather than how you thing you want to achieve it but can't do? The more we know, the better we can reply. |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
okay..thanks a lot Bill and apologies for the brief information. Here is the problem:
We have 2 jobs J1 and J2. J1 creates a PS file say F1. J2 will be run after J1.
When we run J2 we need to verify that the file F1 created in job J1 has the last edited timestamp which is less than or equal to the current timestamp.
this is the reason why i want to know how to fetch any PS/GDG versions files last edited timestamp.
Is it possible? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
When we run J2 we need to verify that the file F1 created in job J1 has the last edited timestamp which is less than or equal to the current timestamp. |
I find hard to believe that a timestamp
- something that relates to a past event
could be higher that the current date/time |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
J2 runs after J1 enrico
so the file created in J1 will have last edited timestamp less than current timestamp |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
As enrico has pointed out, there is no need to test for what you say as, logically, it must always be true (current "timestamp" will always be larger than any "timestamp" in the past).
If you want to do sensible checking, you have a businiess/data-date on a Header record on your file (along with some other things like a logical filename) and you check that the business/data-date on your input file is equal to the current business/data-date from your control file which contains all the dates you'll ever need, and is updated as the first logical thing in the "run"/"day".
Mainframe PS datasets do not have timestamps. Even if they did, it would be silly to use them, as it would make all sorts of testing and re-runs more difficult. |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
Hi Bill,
Let me explain the real problem. I got it wrong before.
The PS file/GDG file that is created in J1 should not be edited before job J2 is run.
So basically im checking if the last edited timestamp of file Created in J1 is not greater than the job end Timestamp of J1.
Am i clearer now? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Why would it be edited? |
|
Back to top |
|
|
nikhil_bansal04
New User
Joined: 16 Dec 2013 Posts: 12 Location: india
|
|
|
|
Bill, it is a kind of validation.
That is should not be edited.
If a user opens it in edit mode by mistake and accidentally changes it, that scenario should not occur |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
unfortunately ...
the only way to check if a file has been tampered is a checksum |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
nikhil_bansal04: What Mr. Woodger and Mr. Sorrichetti are telling you is that MVS data sets do not, repeat do not have the date and time the data set was last modified as a data set attribute. MVS data sets do have the date the data set was created, the date the data set was last referenced, and the date the data set is to be retained. The date the data set was last modified is not a data set attribute as is true for files in Windoze and, I presume, in *nix. The dates I mentioned can be obtained by a Rexx EXEC using the LISTDSI function as documented in the appropriate Rexx reference manuals.
This data was defined in the 1960s, where programs that accessed data sets generally were run not more often than once a day; the designers did not see a requirement to store a time of day as a data set attribute, or the date and time the data set was last updated. The data set labels where this type of data is stored do not have room to store time of day.
The SMF data mentioned by Mr. Woodger is a separate log data set maintained by the system. These data sets are very large, generally containing gigabytes of data for each day, and ordinary Rexx I/O cannot be used to access them. SMF data that describes when a data set is opened for output does have the time of day the data set was opened, but, as I mentioned, getting to this data in Rexx is quite difficult. |
|
Back to top |
|
|
David Robinson
Active User
Joined: 21 Dec 2011 Posts: 199 Location: UK
|
|
|
|
nikhil_bansal04 wrote: |
If a user opens it in edit mode by mistake and accidentally changes it, that scenario should not occur |
Surely your security system will be set up such that these accidents cannot happen? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Who determined there is such a requirement?
Why are people allowed to "edit" this file at all? There should be a maintenance program that creates an audit trail (log file) of any maintenance performed.
The audit trail can be read to see it there was a late change.
The edit program could also make sure that the last entry was from J1 beibng run. J1 would need to make a log entry when it runs. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
nikhil_bansal04 wrote: |
okay..thanks a lot Bill and apologies for the brief information. Here is the problem:
We have 2 jobs J1 and J2. J1 creates a PS file say F1. J2 will be run after J1.
When we run J2 we need to verify that the file F1 created in job J1 has the last edited timestamp which is less than or equal to the current timestamp.
this is the reason why i want to know how to fetch any PS/GDG versions files last edited timestamp.
Is it possible? |
Hows J2 modifying the file?
is the step getting executed only when some condition is met?
there could be far better solutions than reading time-stamp of when was it last modified
You probably have to state your requirement rather than how YOU want to achieve it. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Firstly, SMF record 15 is "OPEN FOR OUTPUT" but does not guarantee that any updates have been actioned.
Secondly, this seems to be an occasion where a GDS is not the best solution. If J1 creates the required file, and J2 then reads and deletes the file, you can't go wrong really.
Can you ??? |
|
Back to top |
|
|
|