If you are going to always use 6 months previous insuring that you won't
ever want to search for records before a 19YY-MM-DD date, and you really
are using DSPOBJD as a start, then this works:
Field Expression
ODUDATCYMD ODUCEN||substr(odudat,5,2)||
substr(odudat,3,2)||
substr(odudat,1,2)
SIXI char(current(date)-6 months,iso)
SIXCYMD '1'||substr(sixi,3,2)||
substr(sixi,6,2)||
substr(sixi,9,2)
AND/OR Field Test Value (Field, Number, 'Characters', or
..)
ODUDATCYMD LT sixcymd
Objects with no lasted used date will appear in this list as Blanks is
less whatever your date ends up being.
Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Steinmetz, Paul
Sent: Thursday, June 30, 2016 10:29 AM
To: 'Midrange Systems Technical Discussion'
Subject: RE: AS/400 query with date - 6 months
Below is my query select.
ODUDATCYMD LT '1160130'
DSPOBJD to an output file results with ODUDAT Last used date
(MMDDYY)
To compare an object's last use date, the ODUDAT needs to be reformatted
with the century added.
ODUDATCYMD is a result field from century year month day.
ODUDATCYMD ODUCEN || ODUDATY || ODUDATM || ODUDATD Last
Used Date (CYYMMDD)
I would like to replace the hardcoded literal '1160130' with a variable.
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Darren Strong
Sent: Thursday, June 30, 2016 11:06 AM
To: Midrange Systems Technical Discussion
Subject: Re: AS/400 query with date - 6 months
I'm assuming you're wanting to do some date arithmetic on today's date?
If so, I learned the following from the F1 screen in the Define a column
section of WRKQRY.
char(current(date)- 6 months,iso)
Looks like it works, except that the value isn't numeric, and I couldn't
find a way to make it so.
From: "Steinmetz, Paul" <PSteinmetz@xxxxxxxxxx>
To: "'Midrange Systems Technical Discussion'"
<midrange-l@xxxxxxxxxxxx>
Date: 06/30/2016 10:19 AM
Subject: AS/400 query with date - 6 months
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
I have an AS/400 query with a hardcoded date.
The date is today's date - 6 months.
Example 1160130.
I'd like to make this date a variable.
Can this be done within the query?
Or
Must it be done outside the query and pass the date as a variable to the
query?
Then, instead of calling RUNQRY, I would need to STRQMQRY.
Any thoughts from the group?
Thank You
_____
Paul Steinmetz
IBM i Systems Administrator
Pencor Services, Inc.
462 Delaware Ave
Palmerton Pa 18071
610-826-9117 work
610-826-9188 fax
610-349-0913 cell
610-377-6012 home
psteinmetz@xxxxxxxxxx
http://www.pencor.com/
--
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.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
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.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
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.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.