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



This is what I do:

Prt_Date = %trimL( %char( datefield: *usa ): '0' );

Of course that only gets rid of the leading zero in the month. I do the same for the time. To get rid of leading zeros in the month you might as well start substringing the date and rebuilding it.

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Schutte, Michael D
Sent: Wednesday, August 03, 2011 7:14 AM
To: RPG programming on the IBM i / System i
Subject: RE: Suppress leading zero of *DATE field

Why do you need to write a special routine for suppressing the leading zero? Doesn't this do what you want?

Charfield = %Char( datefield : *USA );


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Tuesday, August 02, 2011 6:25 PM
To: RPG programming on the IBM i / System i
Subject: Re: Suppress leading zero of *DATE field

On Tue, Aug 2, 2011 at 5:32 PM, Timothy Adair <tadair@xxxxxxxxxxxxxxxx> wrote:
In the printer output specs of my program, I am attempting to suppress
the leading zero on a *DATE field. According to the RPG ILE manual
(v6r1) I should be able to do this with a "Y" edit code.

Edit codes only apply to numeric fields, as your error message indicated. The date type is not a numeric type. (Someone will correct me if I'm wrong, but I believe In the old days, there was no date type, so usually dates were stored as a number, which allowed use of edit codes or edit words to modify how they were displayed. This practice is still very common today.)

If you want to use edit codes, you will have to convert your date field to a numeric type first. You can do this simply with MOVE, or you can use built-in functions.

If reformatting dates for output is something you will be doing a lot (and I would think it is), then my recommendation would be to bite the bullet and write some date routines that you will use over and over again. (I've done this to allow more flexible editing, such as omitting the leading zero for both the day and the month, as Excel normally does.)

John
--
This is the RPG programming on the IBM i / System i (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.

________________________________

Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.
--
This is the RPG programming on the IBM i / System i (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 ...

Follow-Ups:
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.