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



Ok.

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:50 AM
To: RPG programming on the IBM i / System i
Subject: RE: Date Validation

I figured it out, the varying field needs a length of 10, I added the following line to my test program before the conversion and now it gets the date correctly.

%len(Date_in) = 10;

As long as the length of the varying is 10 or greater then %date works fine but if it is less that 10 you get an error on %date.

Scott Mildenberger

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Mildenberger
Sent: Wednesday, May 30, 2012 10:46 AM
To: RPG programming on the IBM i / System i
Subject: RE: Date Validation

Paul, Your right that it works fine when you have Date_in defined as 10A but the original post had it defined as varying 256A and that does not work - I even tried %trim on Date_in. So, I get the error with the following definition

D Date_in S 256A Varying inz('5/7/2012')

Beyond me to explain!

Scott

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Therrien
Sent: Wednesday, May 30, 2012 10:21 AM
To: RPG programming on the IBM i / System i
Subject: RE: Date Validation

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

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