|
Hello Wilson, Please find a procedure in the attached word document. We use this common procedure to validate any type of dates in our application. All we do is move the screen filed/database file field (namely,date field) to a temporary variable WS-T-VALIDATION DATE (of type and length 8S0). This variable WS-T-VALIDATION-DATE should be sent in the format DDMMYYYY. (Hint: Use some temporary numeric data structures and pass the date to be validated in DDMMYYYY format.) The rest of the processing will be taken care of by the procedure. Take care to declare the following variables in the working storage section: 01 WS-T-VALIDATE-DATE. 05 WS-T-VALIDATE-YEAR PIC 9(4). 05 WS-T-VALIDATE-MONTH PIC 9(2). 05 WS-T-VALIDATE-DAY PIC 9(2). 01 WS-T-VALIDATE-DATE-II. 05 WS-T-VALIDATE-DAY-II PIC 9(2). 05 WS-T-VALIDATE-MONTH-II PIC 9(2). 05 WS-T-VALIDATE-YEAR-II PIC 9(4). 01 WS-T-VALIDATION-YEAR. 05 WS-T-VALID-MONTH-DAY PIC 9(6). 05 WS-T-VALID-SHRT-YER PIC 9(2). 05 WS-T-VALID-SHRT-YER PIC 9(2). 01 WS-T-VALID-CENT. 05 WS-T-VALID-CENT-MTH-DAY PIC 9(4). 05 WS-T-VALID-CENT-CENT PIC 9(2). 05 WS-T-VALID-CENT-YEAR PIC 9(2). 01 WS-T-SYSTEM-DATE PIC 9(6). 01 WS-T-VALIDATION-DATE PIC 9(8). 01 WS-T-QUOTIENT PIC 9(3) COMP-3. 01 WS-T-REMAINDER PIC 9(1) COMP-3. We have a flag WS-T-VALIDATION-ERROR-FLAG to track any errors down the line. Initialize this flag to blanks. Invoke the routine in the attachment. If there is error, WS-T-VALIDATION-ERROR-FLAG will be set on. Hope this helps you... Regards, -----Original Message----- From: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] Sent: Friday, April 08, 2005 4:37 PM To: Cobol400-L@Midrange. Com (E-mail) Subject: [COBOL400-L] how to validate date in cobol400 hi all!! how do we validate differents formats of dates, especially iso format(yyyy/mm/dd). TIA!!! GODBLESS!!! Wilson _______________________________________________ This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/cobol400-l or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-l. ************************************************************************** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. **************************************************************************
As an Amazon Associate we earn from qualifying purchases.
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.