Programmatically getting datasets timestamps

I’d appreciate if someone could shed some light on how I could programmatically get datasets timestamps, typically when they were created or last modified. It seems there exist properties such as c4date, m4date, mtime0, among many other useful ones, but how to (reasonably easy) programmatically access them?

For instance, is there an (MVS) utility (preferably) which would dump that info?

Thanks in advance.

It seems that the c4date, m4date and mtime0 attributes are zFS specific, that is, it’s related to z/OS UNIX File System, not really what I’m looking for.

Starting to dig on the subject my initial findings include:

The last time the file was accessed (read).
The last time the file was modified (write).
The last time the file status was changed.

For system-managed PS data sets and system-managed VSAM data sets, atime and mtime are fully maintained, and the ctime value is set to the mtime value.

Time stamps for non-system-managed VSAM data sets are set to the current time.

For non-system-managed PS and direct access (DA) data sets,
… when the file is accessed again, the time stamps are regenerated (?).

MVS does not maintain time stamps for members of a PDS, only for the PDS data set. MVS creation and reference dates are maintained in the DSCB control block.

MVS maintains the PDSE member create/change time stamp (mtime) in the PDSE AX cell. The Server uses a FileAccessMethodService (FAMS) call to retrieve/save the member attributes (containing time stamps) from/to the PDSE AX cell.

MVS maintains PDSE / SMS-managed PDS atime, mtime time stamps in the Catalog AX cell. The Server uses an SVC26 call to retrieve/save the data set attributes (containing time stamps) from/to the Catalog AX cell.

For PDS, atime = mtime = ctime = DSCB_reference_date + time_increment. If the dataset has not been reference yet, then DSCB_reference_date is zero. The time_increment can be the server local TOD or the fixed-value of 23:59 if DSCB_referece_date does not match TOD.

It seems I now have to dig on:

  • DSCB (data set control block)
  • Master Catalog data set attribute extension (AX) cell
  • SVC26

Perhaps that’s not gonna be that easy anymore…

Apparently, MVS doesn’t consider timestamps important to application programmers, which could be due to the less complex scenario from the past. Maybe it would be fair to state that nowadays many applications are comprised of many more interdependent modules requiring a more automated, on-demand, building process. That’s where I would say that accessing dataset timestamps become important for the application programmer. I know there are commercial solutions, but the goal is to keep a conservative budget.

The DSCB (Data Set Control Block) for non-VSAM data sets seems to be in Format-1 which is documented on DFSMSdfp Advanced Services.

  • At offset 53(X’35’), mask:Character, length:3, name DS1CREDT.
    (creation date ‘YDD’)
  • At offset 75(X’4B’), mask:Character, length:3, name DS1REFD.
    (date last referenced ‘YDD’ or zero if not maintained).

In the following example, the format-1 DSCB for data set A.B.C is read into virtual storage (WORKAREA) using the SEARCH option. The serial-number of the volume containing the DSCB is 770655.

             OBTAIN   DSCBABC
ABC          DC       CL44'A.B.C'   DATA-SET NAME
VOLSER       DC       CL6'770655'   VOLUME SERIAL-NUMBER
WORKAREA     DS       140C          140-BYTES WORK-AREA

The problem now is to code a HLASM module for relaying such a timestamps to a higher-level language such as PL/I or COBOL or perhaps (better) to make the HLASM module compare the timestamps for two datasets and set a return-code to be used at the JCL level.

I can only tell you that, on the DEC VAX, there were “system calls”, that we could access, from COBOL.

It might be, that the IBM has a “system call” that you could execute, from within your program, and use some, specific string, to tell that “system call” to return the time-stamp that you want.

In our computer’s COBOL, we had some RESERVED-WORDs for “date” and “time”.

But, in at least one instance, the “time” variable we generally used wasn’t precise enough.

I think we had to use “system-calls”, after that.

It was a lesson. Time-stamps are important.

Programmatically getting MVS data-sets timestamps seems a surprisingly difficult accomplishment, beginning by where to find the related documentation, assuming it’s publicly accessible. I’ve been trying to browse the whole z/OS 2.5 PDF collection from Sep2021 and so far I couldn’t hit the tip of the iceberg.

It’s hard to believe that that piece of information I’m looking for (a dataset timestamps) isn’t buried inside some (undocumented?) buffer returned by some (less known?) “system service/utility” macro.

I can’t help wondering why all this difficulty. Would that be by a technical design limitation, by some sort of policy restriction or simply due to a documentation omission. It’s funny how I can find tons of “useless” information but not a single clue beyond what I’ve already previously posted.

I’m planning to “invest” some time playing with the HLASM and some macros…

Some computer manufacturers have gone out of business, over the years.

Some of them made beautiful computers that were a joy and a pleasure to work with. So, why are they gone?

I was a COBOL programmer; and, one day, I did something, with “system calls”, that “saved the day”, for the organization.

Nobody said a word about it; so, I thought they were jerks.

Thirty years later, I thought about it, again; and I realized that, if I’d been someone who had been “out for myself”, rather than being “a company man”, the power that I had used, for the benefit of the organization and for the organization’s customers and mission, could have been used, to perpetrate all kinds of sneaky, underhanded, subversive “tricks”, “pranks”, and even sabotage.

If you’re using old technology, you’re probably going to have to rely on the relationship that exists, between the computer’s owner and the IBM rep, to get that documentation.

And --assuming that the documentation is available, in an archive, somewhere-- IBM is probably going to want some kind of assurances, not only from the organization, but from you and all of the programmers, regarding your identity, intentions, and the reason(s) that you are using that technology.

The “Tet Offensive” actually happened.

Using an MVS computer, in 2023, probably appears, in the eyes of certain sales execs, to be the digital equivalent of walking along a country road, instead of driving along the highway.

If you ask for some heavy-duty documentation that would let you “soup up” that mainframe, to turn it into some kind of all-terrain vehicle or hovercraft, instead of a “station-wagon”, you’ll have to expect somebody to wonder why.

My advice (as if you might want advice from me, in this matter) would be:

"Expect, AT BEST, to be pointed in the direction of finding one piece of what you’re looking for; and realize the fact that, even if it’s put right in front of you, you might not ‘see’ it.

"Expect that ‘what you do, with that information’ MIGHT qualify you to get access to more.

"Recognize that you MIGHT be operating in a world in which there might be relatively few, whose goals, motivations, attitudes, and circumstances are compatible with your own.

"Be loyal to whatever or whomever you’re loyal to.

“Do your best, to ‘do the right thing’, as you understand that ‘right thing’ to be.”

Other than that,

Good luck.

1 Like

When I get some (should I say plenty? of) time I’ll compare the contents of the WORKAREA returned by the SEARCH option of CAMLST macro for a non-VSAM (that is, QSAM) data-set looking for a format-1 DSCB which could correspond to a respective TSO/E’s LISTDS data-set LABEL output.

If successful, even not being a fine-grained value (as it seems) it shall suffice to my goals. Let’s see, all that is easy to say but hard to achieve. In the processes I shall learn the basics of HLASM for COBOL or PL/I low-level subroutines such as this. Perhaps I can even delve into some pure assembly binaries.

:upside_down_face: I’m equipped with:

  • HLASM Toolkit v1.6 & other tons of IBM’s public PDFs
  • A classic book on S360/S370 Assembly Language Programming

When I read your email, I thought it was beautiful, even though I know nothing, whatsoever, of the technicalities of IBM computers, their data-structures, or JCL.

Please beware, however. If you are going to make those kinds of investigations, you might see things that none of your colleagues will have seen.

NONE of them.

And that difference in experience MIGHT cause an inability for them to understand you, if/when you try to explain something to them.

One day, on my old [non-IBM] computer, I was working on a task, for work. And I used a COBOL program to “grab” some unallocated disk-space.

And, before I did anything with it, I “dumped” it to my screen, byte-by-byte. MAYBE --it was too long ago, for me to be able to remember the details of “why?” or “how?”-- I kept the program from “crashing” by evaluating each byte, before displaying it.

[i.e., something like…


And it was in that moment, when I realized that “DELETED (or ‘modified’/‘over-written’)” files aren’t actually “overwritten-with-zeros”, but are merely “rendered invisible” by…

…changing the “value” of the “pointer” that tells the operating-system where or is located,…

…and causing that “pointer” to “point to” some new location, on that disk.

So, how did I react, to that “evidence” and that knowledge? I simply started using an operating-system option, to “zero-out”/“overwrite-with-zeroes” every byte of all deallocated disk-space.

No problem.

The only think that happened, was, that I knew I was “good”, conscientious, and protective of my organization and its people.

BUT, later on, a few years later, my private/personal email account (provided by my own ISP) was bombarded with SPAM. HUNDREDS of emails per day.

The content of those emails looked exactly like the “screen-dumps” I had made, of unformatted, previously-allocated disk-space.

So, I started examining it, to see if I could figure out where those emails were coming from.

And I went insane. Because, it looked like the parts that were human-readable were emails or word-processing documents that were contemplating revolution!

And I couldn’t report it, because the people I tried to report it to, told me not to come back, or I’d be arrested.

In order to hold onto whatever shreds of sanity that remained to me, in those days, I had to tell myself that everyone was “playing dumb” or “pretending to be stupid”, in order to cause me to believe that I was “imagining things” or “making a mountain out of a mole-hill”, in order that I would stop talking about something that was “above my pay-grade”, so that they --the ones who were paid to solve exactly those kinds of problems-- could “take care of it”, without having to deal with the kind of frantic, drug-addicted “elementary-school-kid” that I, surely, seemed to be, in their eyes, in those days.

So, beware.

Stay away from drugs, whatever you do.

And don’t walk alone, in your investigations.

I don’t care if your company makes Barbie™-dolls or nostril-hair-clippers! Be careful.


PS: In the old “Scooby-Doo” [cartoon] TV-show, there was no “haunted house” or “witchcraft”/“magic” that wasn’t, in actuality, a criminal who was trying to “cover his tracks”.

But, Alzheimer’s, dementia, and alcoholism/drug-use can cause things that SEEM to be criminal (or, merely, “malicious”) activity, but which are, in fact, the result of “sleep-walking” or “black-out” that people simply can’t recall, the next day. --ljp2

What a story! :wink: :upside_down_face:

I’m just trying to compare 2 timestamps for finding out which one is more recent.

If I succeed I would be able to fully automate the workflow which builds a relatively non-trivial application, similarly to any popular flavor of a make utility, although I’m not trying to reinvent any wheel. This will make me more productive, just that.

Ah! I understand! Increased productivity is a good goal.

I hope you are able to achieve it.


Can you programmatically find the location on the disk, where the record is, that you want to get a time-stamp for?

If you knew that physical location, would you be able to access the disk-access logs, and find out the last time that physical location was updated?

Would that “conjecture” be a good-enough approximation of a time-stamp for a specific record, in a file?

I think I’ve grasped the system call (macro in IBM’s parlance) at least for QSAM data-sets, which suffices to me as all my source and binaries are on QSAM (PS or PDSE). I suppose it’s the CAMLST I’ve previously mentioned.

Yes I think the conjecture is definitely in right direction because the TSO/E interactive environment seems to confirm this on the output of a LISTDS data-set LABEL. That is, I think that the LABEL is precisely where the timestamp is located and it seems to be copied to the WORKAREA buffer after calling the CAMLST macro at assembly level.

Bottom line I think I just have to code a tiny assembly module to invoke the macro, extract the timestamp from the buffer and return it to COBOL or PL/I.

I can understand what you’re saying; but, if you are a programmer who is doing actual, regular work in COBOL (or any other language that delivers work to non-technical end-users), and yet, you have been trained to write programs (aka: “modules”), in your computer’s “assembly-language”, then:

  1. you are experienced, and are trusted by your employer;

  2. your employer is very lucky; or

  3. your use of “assembly-language” is likely to be monitored, evaluated for appropriateness, by your employer, and “subject to review, whenever there is a question”.

The computer that I worked on offered “macros” / “system services” that could be “called” by my COBOL programs; and those “systems services” would return, to my COBOL programs, the values of any number of system-infrastructure-related variables.

But, it was a standard, well-documented interface, complete with well-written, easy-to-understand manuals, for all of it.

By means of “system services” related to such areas as “[file- / data-set-]records management” or “[display-terminal-oriented] forms management”, etc.,…

…I was able to write interactive / GUI-type applications that performed database-query/database-update operations, using COBOL, simply by “calling” those “system services”.

I felt quite “technical” and “accomplished”, to be able to perform such feats, as a business-system programmer, in the age of “dumb terminals” and “centralized” data-systems.

BUT, I did not know how to write assembly-language programs.

As such, whatever mistakes I might have made, in doing my work --and (more significantly) “whatever problems I might have caused, to ‘the business’, as the result of my mistakes”-- could have been:

  1. detected, analyzed, and diagnosed, after-the-fact;

  2. anticipated, “BEFORE-the-fact”, and mitigated; and

  3. known, by any auditor, to have been undeniably perpetrated by ME,…

…so that APPROPRIATE corrective action could have been taken, for the protection and benefit of all (including me).

Everywhere I went, on every computer I have worked on, I traveled by means of a “path” that had already been created and paved.

I’m okay with that.

I’ve already had the experience of awakening, in the night, with a start, sitting bolt-upright, at the thought of something left undone, or “in realization of a flaw”.

I like being dedicated, as well as “innovative”, “bright”, and “able to find a way” to solve problems. But, I’m not a ninja. I was fine, as a priest or deacon; I would not have been any good, at all, as a wizard or warlock.

I respect and even admire the ability to write in “assembly-language”; but, “Be careful, out there.”

Yes, indeed: the status-quo is boring and definitely there’s still some room for improvements, but who cares? The rigid structuring has its favoring arguments as it has its downsides. I think this industry is trying to evolve while preserving it’s high valued backlog, but I’m not convinced it has already found a sounding solution. We still have excellent legacy technology which has not been fully exploited as its best. The new hype is AI but who dares pose any criticism on it and pay a high or ultimate price of being severed for good? Again time will teach us all what’s good and what’s bad, we just have to try to survive long enough and see for ourselves. :wink:

By the way, slightly changing subjects for a moment, have you worked with VMS?

Have you heard about the latest public release of OpenVMS 9.2 for x86-64 on VirtualBox using a hobbyist/community license?

It seems they include varied software, including COBOL, C, C++ compilers among many other things, which seems interesting for refreshing some high-level programming skills. But they also include more “modern stuff” such as TCP/IP networking and notably SSH, Kerberos and so I’m wondering if this could allow leveraging integration of legacy batch applications with other “internetworking technologies”.

Fortunately, nowadays with can legally run our own IBM MVS (the free option of the legacy MVS 3.8j or the non-free modern z/OS emulation on Hercules-390) or this OpenVMS. On these environments we are relatively free to experiment, learn and evolve.

I was getting ready to dive into the bits & bytes when I could get some partial results just by using some well-known IBM utilities (IDCAMS & IEHLIST). The values seems to be “coarse” (just Julian dates); but I’m still browsing for more detail (it seems possible to collect fine-grained timestamp at least for the dataset creation-date; but no clues yet for datasets reference-date).

Here’s the IDCAMS command and its output which already reveals the (coarse) creation date and volume name (subsequently required by the IEHLIST utility):

         ... CREATION--------2023.272
         ... EXPIRATION------0000.000
         VOLSER------------VXXXXXX ...

And here’s the IEHLIST commands (formatted & raw) and their output:


                              SYSTEMS SUPPORT UTILITIES---IEHLIST                               PAGE    1
DATE: 2023.301  TIME: 10.12.12
ZXXXXX.TEST                                   VXXXXX      1  2023.272    00.000  2023.301    1  PS   FB     00    27920
  R          80            TRKS               1                         0   1 56644                            3   7  35
            EXTENTS  NO  LOW(C-H)   HIGH(C-H)
                       0   297  1      297  1
                                ----ON THE ABOVE DATA SET,THERE ARE          0 EMPTY TRACK(S).

                              SYSTEMS SUPPORT UTILITIES---IEHLIST                               PAGE    2
DATE: 2023.301  TIME: 10.12.12
 LINE 1 = DSNAME                 0 . . . 4 . . . . 9 . . . .14 . . . .19 . . . .24 . . . .29 . . . .34 . . . .39 . . . .
 LINE 2 = 44 . . . .49 . . . .54 . . . .59 . . . .64 . . . .69 . . . .74 . . . .79 . . . .84 . . . .89 . . . .94 . . . .
 LINE 3 = 99 . . . 104 . . . 109 . . . 114 . . . 119 . . . 124 . . . 129 . . . 134 . . . 139           DSCB ADDR (CCHHR)
          0001DD4400000100012900010129000100000000000000000000000000000000000000000000000000           0003000723

The interesting part is the DATE.REF which reads the Julian date 2023.301 or better yet the last 2 lines which dumps the full DSCB type-1 where both dates are encoded among other possibly useful fields.

The DSCB fields are publicly described on IBM’s idas300_v?r?.pdf (z/OS DFSMSdfp Advanced Services), Chapter 1 - VTOC Components.

I was planning to get these last 2-lines of DSCB information from an Assembly module called from COBOL or PL/I, but by the above findings it seems I won’t get any additional value than what IEHLIST already dumps. The problem of relying on timestamps may have no feasible fine-grained solution after all.

To wrap-up this long series of postings, an auxiliary application program could automate these kind of jobs or job-steps for 2 datasets into the internal reader and then parse the results of IEHLIST DUMP DATE.CRE and DATE.REF for returning an appropriate RETURN-CODE to be used by another JCL acting as “make”. I think I’ll try to combine this with some additional ad-hoc version number appended to dataset names, somewhat similarly to what is found on VMS. :neutral_face:

Yes, I did work with VMS.

I had not heard anything, at all, about it, until you mentioned it, just now, in your email.

I am surprised that people still want it; but, I’m glad they do. I thought VMS was elegant, powerful, and easy-to-use.

The x86-64 is a PC-type CPU, right? So, the OpenVMS operating system [or, maybe, an “operating environment”-type emulator] probably runs as an application, on top of the chip’s own operating-system, right?

I just “Googled” the VAX; and I see that there are still a few of them in operation.

I pray to God that the computer scientists who know about such things have used these last 30 years productively; and that it is no longer possible, to touch anything, whatsoever, on any device that is connected to a Vax that is running VMS, without some kind of “system log” structure being able to:

  1. know that “something happened” (even if only “after-the-fact”); and

  2. figure out who did what, and when.

I loved that machine, that operating-system, and that company. I could have spent a lifetime, learning about every aspect of what it was, that made it tick.

Maybe, someday, I’ll get my act together, and get a PC, again, and start doing serious work.

But, to tell you the truth, the things that I think of, as projects, would be:

  1. to design some music-composition software that would allow someone who never went to school, to study music, to actually “write” a symphony, simply by pulling musical notes (sounds) from recordings of the sounds of instruments, and stringing those sounds together;

  2. to figure out a way to develop a “language” that would describe the movements that dancers make, when choreographers create ballets and other dances; so that, by the time the choreographer has completed the creation of a ballet, he/she/they will be able to provide, to the dance-troupe, not only a CGI-created video of the dance, but a CGI-generated video FOR EACH DANCER, of that dancer’s own “part” in that ballet; and

  3. to use Peter Russell’s “Mind Map” idea, to create a digital representation of the linkages [i.e., the relationships] that exist, between and among words, in the English language, in order to “navigate” between those concepts in a way that is similar to the conceptual model of a CODASYL database [IDMS? on the IBM, or DBMS, on the VAX].

Why? Because, once I’d have done it, for English, I would do it, for other languages (including languages that do not distinguish between present and past, and languages which do not use alphabets, but ideograms or hieroglyphics).

And, once I had accomplished THAT, I would “run” the English-language version of an international contract (for example) through that “Mind Map”, with the objective of creating one, infinitely-narrow-yet-completely-unique “color-code” that is calculated from the words that comprise that contract, together with the usages of those words, as written.

And, once I had done THAT, I would run the “foreign-language translations” of that contract (for example) through the “Mind Map” for THAT language, with the objective of seeing whether or not the machine would generate the same “color-code”, for the “FOREIGN-language” version of the English-language contract, as was generated, for the ENGLISH-language version.

The goal would be, that all signatories to the contract would be able to understand not only “the contract that they are signing”, but “the contract that THE OTHER SIGNATORIES are signing”.

BUT,… W-H-Y ???


:upside_down_face: Impressively creative!


Creativity is the name of the game; we’re all creative.

You were creative, when you figured out how to get those time-stamps. You were creative, when you established the goal of “obtaining those time-stamps”, as one “step” in the process of solving an actual, real-life problem that someone is paying you money, to solve.

Without creativity, there would be nothing; everything would, simply, stop.

Everyone who has any kind of job is a participant in an economic system whose engine is the willingness and ability of people, to, in the course of living their lives:

  1. identify problems; and

  2. develop solutions to those problems, by means OTHER THAN lashing some poor ox or dray[mule] until it falls over, dead.

In my former life as a “computer-type person”, I experienced a certain, specific (limited) triumph, on a project that involved many stakeholders. My then-boss told me that what I had done, had been, to “make ‘the impossible’ possible”.

He said that it had not been the first time; and that my penchant for “making ‘the impossible’ possible” was the reason that my name was being spoken --the implication was, “favorably”-- by high-level, responsible people, in multiple, far-flung places, across the country.

[NOTE#1: That fact didn’t keep me from becoming homeless and “living under a bridge”, afterwards, for a year and a half. Don’t do drugs.]

[NOTE2: That “certain, specific (limited) triumph” consisted, merely, of “calling and holding a meeting (and developing a time-schedule, as the work-product of that meeting)”, on a project that not one participant could afford to see fail. If I hadn’t done it, someone else would have done it (probably “differently” and maybe “too late”).]

Using a VAX or PDP (or other, “outdated”, “obsolete” platforms that can be bought, for pennies on the dollar) is probably a good strategy, for organizations whose leadership would prefer to spend their finite resources, getting work done, rather than allocating an ever-increasing share of those resources to the task of defending the platform from hostile assaults.

OpenVMS probably exists, in order to develop and maintain a “talent pool” of people who would be able to work on those systems, into the future.

Maybe, if the owners of the hardware know the reasons that the hardware and/or system-software became “obsolete”, in the first place (other than “speed” and/or “bus capacity”), they’ll be able to “guard all approaches” in a fairly-effective, relatively-cost-conscious manner, simply by virtue of that platform’s NOT being considered to be “sexy” enough, to be worth the time/effort needed, to “break in” and either “ransack” or “plunder” whatever is within, or to “hide”, there, like the Qur’an says that Muhammad did, in that cave.

From what I recall from a late 80s mid-range DEC/VAX is that for me it seemed reasonably user-friendly, well-documented and feature-rich multiuser/multitask/multiprocessing system of that time. But I don’t know about its performance and other technical metrics/fact-sheets or some other marketing flagship characteristic. :peace_symbol: :crossed_fingers: