Page 1 of 2

Create/Update Timestamp of a Dataset through Rexx

PostPosted: Mon Mar 11, 2019 8:39 pm
by pinakimishra
I have a requirement where I need to find out the Last Update Time of a Flat file or a GDG. Can I know with any function of REXX?

I have to run a copy job after the flat file is updated or a new GDG has been created. I can check the creation date of the GDG and compare with Today's date but it might be that the GDG is being still written and after comparing the date, I am trying to copy the file which will create a contention. I need to copy the file as soon as the file is created.

Is there a way I can know through Rexx if a file is created today and is closed and not in open so that I can copy it?

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Mon Mar 11, 2019 9:23 pm
by steve-myers
Sorry, but the general answer to your question is NO.

There are three data set attributes of interest.
  • DS1CREDT Dataset creation date
  • DS1REFDT Data set reference date
  • DS1DSIND/DS1IND02 A bit that indicates the data set has been altered. This bit is mainly intended for HSM type programs and is reset when HSM creates a backup of the data set.
I'm pretty certain DS1CREDT and DS1REFDT are available through the Rexx and CLIST LISTDSI function. I don't think DS1IND02 is available through Rexx.

DS1REFDT was added well after MVS was inflicted on us; it was not in OS/360. I'm not sure when DS1IND02 was added, probably after DS1REFDT.

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Mon Mar 11, 2019 9:26 pm
by Garry F Carroll
If the dataset is being created, the job/task creating it will have exclusive control, so your copy job would not be able to copy it until exclusive control is released by the job/task creating it. Your REXX should detect the dataset is under exclusive control.

Garry

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Mon Mar 11, 2019 10:37 pm
by steve-myers
Garry F Carroll wrote:If the dataset is being created, the job/task creating it will have exclusive control, so your copy job would not be able to copy it until exclusive control is released by the job/task creating it. Your REXX should detect the dataset is under exclusive control.

Garry
Actually I suspect that all a Rexx exec could detect is whether it can allocate the data set, not why it can't allocate the data set.

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Tue Mar 12, 2019 3:39 am
by willy jensen
Maybe a loop with something like the WHOHAS command from cbttape.org file 300. That command will show if a specified dataset is in use and by who. No way that I am aware to get the creation time except fom SMF records.

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Tue Mar 12, 2019 5:23 am
by enrico-sorichetti
I have to run a copy job after the flat file is updated or a new GDG has been created.


while all the job schedulers provide the facility to schedule a job when a dataset is created
there is NO way to intercept that a dataset has been updated ( opened in OUTPUT for a PS dataset )
for that You will have to change the jcl adding a step top perform the copy

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Tue Mar 12, 2019 3:29 pm
by Blackthorn
enrico-sorichetti wrote:
I have to run a copy job after the flat file is updated or a new GDG has been created.


while all the job schedulers provide the facility to schedule a job when a dataset is created
there is NO way to intercept that a dataset has been updated ( opened in OUTPUT for a PS dataset )
for that You will have to change the jcl adding a step top perform the copy


I disagree. TWS at least acts on the dataset closed record (type 15). It makes no difference whether the dataset is freshly created or an old one being updated.

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Wed Mar 13, 2019 12:52 pm
by expat
But the type 15 only shows the dataset being opened for output, it doesn't show that there was an update or not.

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Wed Mar 13, 2019 4:57 pm
by Blackthorn
expat wrote:But the type 15 only shows the dataset being opened for output, it doesn't show that there was an update or not.


That doesn't seem to be the case. The type 15 is written when the dataset is closed. So, at that point, it knows whether there actually was an update or not. If there wasn't an update, even if it was opened for output, there is no type 15, only a type 14.

Re: Create/Update Timestamp of a Dataset through Rexx

PostPosted: Wed Mar 13, 2019 7:12 pm
by steve-myers
Blackthorn wrote:
expat wrote:But the type 15 only shows the dataset being opened for output, it doesn't show that there was an update or not.


That doesn't seem to be the case. The type 15 is written when the dataset is closed. So, at that point, it knows whether there actually was an update or not. If there wasn't an update, even if it was opened for output, there is no type 15, only a type 14.
No.

All you know, 100% for sure, is the data set was opened to alter the data set in some way. You do not know whether the data set was actually altered.