Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Finding the last edited timestamp of a PS file in REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Finding the last edited timestamp of a PS file in REXX
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: 175
Location: UK

PostPosted: Mon Dec 23, 2013 2:53 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Dec 23, 2013 3:32 pm    Post subject: Reply to: Finding the last edited timestamp of a PS file in
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Dec 23, 2013 3:55 pm    Post subject: Reply to: Finding the last edited timestamp of a PS file in
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Dec 23, 2013 4:06 pm    Post subject: Reply to: Finding the last edited timestamp of a PS file in
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Dec 23, 2013 4:27 pm    Post subject: Reply to: Finding the last edited timestamp of a PS file in
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Dec 23, 2013 5:02 pm    Post subject: Reply to: Finding the last edited timestamp of a PS file in
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 User


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

PostPosted: Mon Dec 23, 2013 5:03 pm    Post subject:
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: 175
Location: UK

PostPosted: Mon Dec 23, 2013 5:19 pm    Post subject:
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

Site Director


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

PostPosted: Mon Dec 23, 2013 8:05 pm    Post subject:
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    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Mon Dec 30, 2013 2:32 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us