Just a question, did you guys check whether the OBEJCT_STATISTICS UDTF is
available on your system in the QSYS2 Libraray.
MHE it represents the Object Description Information (at least a subset of
it) but with real timestamp values.
The UDTF can be called as follows:
SELECT *
From Table(qsys2.Object_Statistics('YOURSCHEMA', '*FILE')) x;
In the second parameter a multiple object types can be listed, so the UDTF
can be called as follows
Select *
From Table(qsys2.Object_Statistics('YOURSCHEMA', '*PGM *SRVPGM *MODULE');
Converting a numeric date (MDY) into a numeric date (CYMD) if you do not
have any function can be done as follows.
Select Case when right(Digits(DateMDY), 2) <= 39 Then '1' else '0' End
concat Right(Digits(DateMDY), 2) concat
Left(digits(DateMDY), 4) as DateCYMD
From YourTable;
Just an aside:
Some IBM output files QAEZDISK (use YMD while others (DSPOBJD, DSPFD)
use MDY.
Those files do not always use the date format MDY it depends on your job's
date format, if I run those commands on my maschine with an system date
format of *DMY and job date format *DMY those numeric date fields are
formatted DMY.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Steinmetz, Paul
Gesendet: Wednesday, 11.2 2015 21:22
An: 'Midrange Systems Technical Discussion'
Betreff: RE: Object Last Use Date MDY compare issue
Mark,
Yes, that helps a lot.
I still need the century concatenated when comparing LUD.
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark
S Waterbury
Sent: Wednesday, February 11, 2015 3:16 PM
To: Midrange Systems Technical Discussion
Subject: Re: Object Last Use Date MDY compare issue
Paul:
Commands with *OUTFILE support, like DSPOBJD, let you specify where to put
the resulting data.
You could then do something like this -- (for example with an outfile in
QTEMP created with the DSPOBJD command), -- using SQL:
update QTEMP/DSPOBJD
set ODCDAT = substr(ODCDAT,5,2) || substr(ODCDAT,1,2) ||
substr(ODCDAT,3,2),
set ODSDAT = substr(ODSDAT,5,2) || substr(ODSDAT,1,2) ||
substr(ODSDAT,3,2),
set ODRDAT = substr(ODRDAT,5,2) || substr(ODRDAT,1,2) ||
substr(ODRDAT,3,2),
set ODLDAT = substr(ODLDAT,5,2) || substr(ODLDAT,1,2) ||
substr(ODLDAT,3,2),
set ODUDAT = substr(ODUDAT,5,2) || substr(ODUDAT,1,2) ||
substr(ODUDAT,3,2),
set ODTDAT = substr(ODTDAT,5,2) || substr(ODTDAT,1,2) ||
substr(ODTDAT,3,2),
set ODADAT = substr(ODADAT,5,2) || substr(ODADAT,1,2) ||
substr(ODADAT,3,2),
set ODJDAT = substr(ODJDAT,5,2) || substr(ODJDAT,1,2) ||
substr(ODJDAT,3,2)
to change all of those fields with dates stored as "MMDDYY" to "YYMMDD"
in one pass over the file ...
Then, you can query more easily, sorting those dates is much easier, etc.
Hope that helps,
Mark S. Waterbury
On 2/11/2015 11:01 AM, Steinmetz, Paul wrote:
I frequently need to compare object last use dates.
Some IBM output files QAEZDISK (use YMD while others (DSPOBJD, DSPFD)
use MDY.
When MDY is used, I'm constantly breaking up the LUD into individual work
fields, MM, DD, YY and then concatenating them back together with the
century for the object date compare.
ODCDATCYMD ODCCEN || ODCDATY || ODCDATM || ODCDATD
Is there a better or easier way of accomplishing this?
Thank You
_____
Paul Steinmetz
IBM i Systems Administrator
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.