×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Tim,

It sounds like you are attempting to use an edit code reserved for a
numeric value (not a *char with 0-9) on an alpha-numeric field (is a
*char).

You basically have 2 choices: One is to convert the field you are
printing to a numeric field or strip leading zeros from the string and
left justify it. The examples below are for ILE RPG.

The data structure below can be used

D dataStruct DS
D rptDate 10S 0
D yourCurrentDate 10A overlay(rptDate:1)

Or you can use %int built-in function

rptDate = %int(yourCurrentDate);

To strip the leading zero you can do the following.

If (%subst(yourCurrentDate:1:1) = '0');
%subst(yourCurrentDate:1:1) = *Blank;
yourCurrentDate = %trim(yourCurrentDate);
endif;


HTH,

Gary


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Timothy Adair
Sent: Tuesday, August 02, 2011 2:32 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Suppress leading zero of *DATE field

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.

Unfortunately, the RPG compiler gives *RNF7059 (Editing is not valid
with a field that is not numeric; the Edit Code or Edit Word defaults to
blanks).

Am I missing something obvious?

~TA~

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

Replies:

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

This mailing list archive is Copyright 1997-2026 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.