I tried this code and it worked for me with V7R1.
Input parm of '5/7/2012' or '5/07/2012' or '05/07/2012'
CALL PGM(TESTRPG) PARM('5/7/2012')
CALL PGM(TESTRPG) PARM('05/7/2012')
CALL PGM(TESTRPG) PARM('5/07/2012')
dtestrpg PR extpgm('TESTRPG')
D Date_in 10A
dtestrpg PI
D Date_in 10A
D Date_Out S 8 0
D Date_Outc S 25a
Date_out = %uns(%char(%date(Date_in:*usa):*iso0));
Date_outc = %char(%date(Date_in:*usa):*iso0);
Paul Therrien
Orion South, Inc.
504-374-9551
800-437-7173
ptherrien@xxxxxxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Mildenberger
Sent: Wednesday, May 30, 2012 11:08 AM
To: RPG programming on the IBM i / System i
Subject: RE: Date Validation
I get the following error with your code when used with the original definitions for the fields and 5/7/2012 for date_in.
Date, Time or Timestamp value is not valid.
The %date won't process the month and day with only one digit for *usa.
Scott
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Prudhomme
Sent: Wednesday, May 30, 2012 9:11 AM
To: RPG programming on the IBM i / System i
Subject: RE: Date Validation
Here's another way to get the "Date_out" from the test program below.
Date_out = %uns(%char(%date(Date_in:*usa):*iso0));
This works for 05/07/2012 and 5/7/2012.
Paul Prudhomme
--
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.