Create/Update Timestamp of a Dataset through Rexx



IBM's Command List programming language & Restructured Extended Executor

Create/Update Timestamp of a Dataset through Rexx

Postby pinakimishra » Mon Mar 11, 2019 8:39 pm

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?
pinakimishra
 
Posts: 7
Joined: Thu Mar 07, 2019 6:40 am
Has thanked: 0 time
Been thanked: 0 time

Re: Create/Update Timestamp of a Dataset through Rexx

Postby steve-myers » Mon Mar 11, 2019 9:23 pm

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.
steve-myers
Global moderator
 
Posts: 2087
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 235 times

Re: Create/Update Timestamp of a Dataset through Rexx

Postby Garry F Carroll » Mon Mar 11, 2019 9:26 pm

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
Garry F Carroll
 
Posts: 28
Joined: Wed Sep 19, 2018 8:20 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Create/Update Timestamp of a Dataset through Rexx

Postby steve-myers » Mon Mar 11, 2019 10:37 pm

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.
steve-myers
Global moderator
 
Posts: 2087
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 235 times

Re: Create/Update Timestamp of a Dataset through Rexx

Postby willy jensen » Tue Mar 12, 2019 3:39 am

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.
willy jensen
 
Posts: 338
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 44 times

Re: Create/Update Timestamp of a Dataset through Rexx

Postby enrico-sorichetti » Tue Mar 12, 2019 5:23 am

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2958
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 159 times

Re: Create/Update Timestamp of a Dataset through Rexx

Postby Blackthorn » Tue Mar 12, 2019 3:29 pm

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.
Blackthorn
 
Posts: 128
Joined: Tue Feb 01, 2011 7:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Create/Update Timestamp of a Dataset through Rexx

Postby expat » Wed Mar 13, 2019 12:52 pm

But the type 15 only shows the dataset being opened for output, it doesn't show that there was an update or not.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: Create/Update Timestamp of a Dataset through Rexx

Postby Blackthorn » Wed Mar 13, 2019 4:57 pm

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.
Blackthorn
 
Posts: 128
Joined: Tue Feb 01, 2011 7:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Create/Update Timestamp of a Dataset through Rexx

Postby steve-myers » Wed Mar 13, 2019 7:12 pm

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.
steve-myers
Global moderator
 
Posts: 2087
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 235 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post