On 4/8/21 2:45 PM, Mark Waterbury wrote:
Do it the same way that the SAVCHGOBJ command does it, by using the
library's changed object list.
Thanks. However:
I took a look at that, and it looks to be an order of magnitude nastier
than what I'd already started doing by the time I saw it.
So here's what I ended up with:
An RPG program, CHKLIBCHG, with two parameters: a 10-character library
name, and a 13-character last-changed date (this must be initialized to
all zeros by the calling program, because by the time I realized it
needed to be initialized, I was writing the calling program).
CHKLIBCHG does a QUSLOBJ on the specified library, with OBJL0300, and
goes through all the entries, one by one. If the object's
last-changed-date (processed through QWCCVTDT and truncated to the first
13 characters) is more recent than the current value, then it replaces
the current value.
If the object is a physical file, then it does a QUSLMBR on it, and goes
through all *those* entries, one by one. If the member's
last-changed-date is nonblank (blank is returned if it's not a source
PF), and more recent than the current value, then *it* replaces the
current value.
Thus, CHKLIBCHG returns the most recent of all the object-level and
member-level change dates it finds in the specified library.
And a CL program, SAVENEEDED, which takes a single parameter, a
10-character library name. It assumes that a save file with the same
name as the library exists in a specified place.
If the save file's creation date matches its change date, it is assumed
to be new and empty, and it saves the library into the save file.
If not, then it calls CHKLIBCHG. If the last-changed-date CHKLIBCHG is
more recent than the save file's change date, then it saves the library
into the save file.
If both of those tests fail, then the save file is up to date.
Eventually, this will also FTP the save file to a small server entirely
inside the firewall, with a date-stamped name, e.g., if the library (and
the save file) is "FOO," and today is 04/08/2021, then it will be
squirted to the server as "FOO.04082021.savf" (or something like that).
--
JHHL
As an Amazon Associate we earn from qualifying purchases.