× 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.



I’m guessing Alan that the comment related to a situation where the components were separate. i.e. day, month, year. But I think the OP somewhere along the way said that they had changed the refs to character.

Numerics can be done the nasty way of course i.e. ( year * 10000) + ( month * 100 ) + day that’s slope and a DS approach would be faster.

Anyway …


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Jan 7, 2015, at 4:32 PM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

I am lost here. If we have a numeric value, why are we converting it to an
alpha value?

d NumDate...
d s 8p 0 Inz(20140101)
d DateField...
d s d
d NumDateUSA...
d s 8p 0
d NumDateAlpha...
d s 10a Inz('01/01/2014')
DateField = %Date(NumDate:*ISO); // or whatever format you need.

// convert to *USA format.

NumDateUSA = %Dec(%Date(NumDate:*ISO):*USA);

NumDateUSA should be 01012014.

DateField = %Date(NumDateAlpha:*USA/);

etc.


On Wed, Jan 7, 2015 at 1:33 PM, Elden Fenison <
Elden.Fenison@xxxxxxxxxxxxxxxxx> wrote:

Seems to me part of the problem is... you can't concatenate numeric
values. So if you're messing with a date and wish to do that... you're
kinda stuck with %editc.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon
Paris
Sent: Tuesday, January 06, 2015 2:51 PM
To: Rpg400 Rpg400-L
Subject: Re: Converting a date

%Char always strips leading zeros. That's why you can't use it on (for
example) US zip codes or when converting dates such as in this example.

Your alternative of %EditC with the X edit code is the correct approach -
but it should not be needed since %Date can take a numeric value. Unless
we're on a really old release. I seem to recall that at V5R1 it could not
handle numerics, but darned if I can see when that changed. I would have
guessed at V5R2 but not sure and can't see it in the manual.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Jan 6, 2015, at 5:00 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:

Lets be clear here... I am guessing; I do not know the right answer.

Is it possible that the %char() bif drops leading zeros? That would
produce a %char() bif of 162015 which would look bad to the %date() bif.
In that case, perhaps the %char(EmpYear2) could be replaced by
%editc(EmpYear2: 'X') etc.?

Just a thought.


On 1/6/2015 1:23 AM, Gary Kuznitz wrote:
Thank you for the test code...

Comments below...
--
Booth Martin<br>
www.martinvt.com<br>
(802)461-5349<br>
Skype: booth.martin<br><br>

Under deadline pressure for the next week. If you want something, it
can wait. Unless it's blind screaming paroxysmally hedonistic ...
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.