Date validation RPGLE

480 pts.
Tags:
AS/400
RPGLE
Hi,
I try to validate the date field but the Indicator sets on for both valid and invalid. Please advice.
D datevalid       S              8A   inz('20131225')    
D dateINVAlid     S              8A   inz('99999999')    
 *                                                                      
 /free                                                                  
  test(DE) *ymd0  datevalid;                                            
  if %error() ;                                                         
     dsply 'Error!' ;                                                   
  endif ;                                                               
 /end-free                                                              
 *                                                                      
C     *YMD          TEST(D)                 datevalid              44   
C  N44'valid'       dsply                                               
C     *YMD          TEST(D)                 dateINVAlid            55    
C 55'INVALID' dsply

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 6  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    D datevalid       S              8A   inz('20131225')
    
    C     *YMD          TEST(D)                 datevalid              44

    You need to use a valid date if you want the test to succeed. "20131225" is not valid for format *YMD.

    Tom

    125,585 pointsBadges:
    report
  • philpl1jb

    Odd, I thought that there was another response to this question.

    It said use *ISO for the format.

    49,550 pointsBadges:
    report
  • BigKat
    there is on the other version of this question Test for date in *DMY format in RPGLE
    7,935 pointsBadges:
    report
  • philpl1jb

    Yes, thanks .. and as you said on that version the format should be *ISO0

     

    49,550 pointsBadges:
    report
  • TomLiotta
    In the other thread, this question here was added as the "Answer". I cut it out and used 'Discuss' to respond. It seemed to be a reasonable continuation of the original question. The OP here probably needs some experience in tracking these threads. -- Tom
    125,585 pointsBadges:
    report
  • as400dev
    Thanks for your response
    480 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following