× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



DIGITS(YEAR)

The DIGITS converts the number to character.



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Silva Marco
Sent: Monday, September 10, 2007 1:46 PM
To: Midrange Systems Technical Discussion
Subject: RE: Create a field in AS/400 queries

Hi,

I'm tried to concatenate but I'm not able because it's numbers. It returns
an error saying that the concatenation is not allowed with the operand sign



Obrigado,
Marco Silva


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: segunda-feira, 10 de Setembro de 2007 18:57
To: Midrange Systems Technical Discussion
Subject: Re: Create a field in AS/400 queries

Marco,

This can be quite easily done in Query/400. However, I recommend you create
a "view" that does this. This will prevent you from having to put this
logic into every query that uses this combo.

Let's say I have a table that has these fields: myear, mmonth, mday (among
others).

If I do the following:
create view qtemp/marcol1 as (
select date(digits(myear) concat '-' concat
digits(mmonth) concat '-' concat
digits(mday)) as RealDate,
a.*
from qtemp/marco a)

I can now query this view, or logical file, in Query:
select *
from qtemp/marcol1
....+....1....+....2....+....3..
REALDATE MYEAR MMONTH MDAY
2006-05-01 2,006 5 1
******** End of data ********

This will save you from putting all that logic in every Query.

Again it is now a true date field:
select days(current date) - days(realdate) as AgingDays,
marcol1.*
from qtemp/marcol1
+....1....+....2....+....3....+....4....+...
AGINGDAYS REALDATE MYEAR MMONTH MDAY
497 2006-05-01 2,006 5 1
**** End of data ********



Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





"Silva Marco" <Marco.Silva@xxxxxxxxxxxx>
Sent by: midrange-l-bounces@xxxxxxxxxxxx
09/10/2007 01:42 PM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
"Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
cc

Fax to

Subject
Create a field in AS/400 queries






Hello



I have tree different fields in AS/400

Year

Month

Day



So I have this:

2007

09

12



And I have to transform those tree fields in 2007-09-12. My problem is
that I can't concatenate because those fields are numbers.



I can I transform those number into a date?





Regards,

Marco




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.