IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Finding the last edited timestamp of a PS file in REXX


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nikhil_bansal04

New User


Joined: 16 Dec 2013
Posts: 12
Location: india

PostPosted: Mon Dec 23, 2013 2:29 pm
Reply with quote

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
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 199
Location: UK

PostPosted: Mon Dec 23, 2013 2:53 pm
Reply with quote

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
View user's profile Send private message
nikhil_bansal04

New User


Joined: 16 Dec 2013
Posts: 12
Location: india

PostPosted: Mon Dec 23, 2013 3:19 pm
Reply with quote

HI David,

I did not get anything from the post. Request you to please elaborate a bit.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 23, 2013 3:32 pm
Reply with quote

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
View user's profile Send private message
nikhil_bansal04

New User


Joined: 16 Dec 2013
Posts: 12
Location: india

PostPosted: Mon Dec 23, 2013 3:53 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Dec 23, 2013 3:55 pm
Reply with quote

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
View user's profile Send private message
nikhil_bansal04

New User


Joined: 16 Dec 2013
Posts: 12
Location: india

PostPosted: Mon Dec 23, 2013 4:02 pm
Reply with quote

J2 runs after J1 enrico
so the file created in J1 will have last edited timestamp less than current timestamp
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 23, 2013 4:06 pm
Reply with quote

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
View user's profile Send private message
nikhil_bansal04

New User


Joined: 16 Dec 2013
Posts: 12
Location: india

PostPosted: Mon Dec 23, 2013 4:16 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 23, 2013 4:27 pm
Reply with quote

Why would it be edited?
Back to top
View user's profile Send private message
nikhil_bansal04

New User


Joined: 16 Dec 2013
Posts: 12
Location: india

PostPosted: Mon Dec 23, 2013 4:53 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Dec 23, 2013 5:02 pm
Reply with quote

unfortunately ...
the only way to check if a file has been tampered is a checksum
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Dec 23, 2013 5:03 pm
Reply with quote

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
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 199
Location: UK

PostPosted: Mon Dec 23, 2013 5:19 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Dec 23, 2013 8:05 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Dec 24, 2013 2:17 am
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Dec 30, 2013 2:32 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top