ibm-midrangejt400jtopen

Get last changed date of AS400 DDS file in Java


Hello I'm working with Java connecting to an IBM AS400.

I want to read the timestamp of the last change of a DDS file, e.g. the timestamp of the last SQL operation (INSERT INTO MyLib/MyDDS VALUES (...)).

In the 5250 terminal, I can go to "work with objects" and open the metadata with choosing option 5 (=show) or simply DSPFD FILE(MyLib/MyDDS). There is the timestamp.

Another way is to run dspjrn jrn(MyLib/MyJournal) to inspect the journal and its timestamps.

How can I access the timestamps from Java, e.g. using JTOpen or SQL?

Thank you :)


Solution

  • Java Specific

    JT400 (and JTOpen) provides classes and methods that interface with system APIs such as QUSRMBRD and return values usable by Java functions.

    For member data changes (and other attributes), see com.ibm.as400.access.MemberDescription field CHANGE_DATE_AND_TIME.

    General

    Native physical files (PFs) can allow multiple data members that can be separately updated. Members are essentially separate objects (of object type *MBR) from the files (of type *FILE) that contain them. The IFS presents database files as 'containers', i.e., as if they are directories. The members are presented much like streamfiles in a directory, and changes to the content of individual members is tracked by member since the containing file objects only have single 'change' dates.

    RTVMBRD is a native command and should always exist. I wouldn't expect it, but authority might restrict access. This would be how CL would normally retrieve data change dates. Alternatively, the Retrieve Member Description (QUSRMBRD) API can be used by any language to retrieve member details.