|
All, Does anyone have any experience or 'best practices' for validating dates of differing formats in RPG? Scenario: we receive data from various sources, each one of which seems to have a different idea of how dates should be formatted. Here in the US most data entry operators use *MDY format, but others feel free to use *MDY0, *USA, etc, etc. Demanding consistency won't work - these are our customers and part of the 'value' our company offers is to allow them to send data in the format they feel comfortable with. At the time they need to validated, the dates have already been parsed into 10A fields in a subfile program, I'm considering writing a procedure to make a 'best-guess' as to the date's format - something akin to the code below. Someone has to have addressed this situation before - would you care to give out a few pointers? Thanks, JK C If s_DatP <> *blank C *MDY Test(de) s_DatP C If not %error C *MDY Move s_DatP w_Date C Else C *MDY0 Test(de) s_DatP C If not %error C *MDY0 Move s_DatP w_Date C Else C *USA Test(de) s_DatP C If not %error C *USA Move s_DatP w_Date C Else C *USA0 Test(de) s_DatP C If not %error C *USA0 Move s_DatP w_Date C Else C Eval SflValErrF = 'Y' C CallP SndMsgToThisPgmQ( 'USR0406' ) C Seton 75 C EndIf C EndIf C EndIf C EndIf C EndIf
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.