|
For V5R1+ my free xRPG Library has this procedure available... check out the docs here for createDate()... http://www.rpgnext.com/docs/rnbdates/xRPG_procedures_createDate.php This also addresses the '010203' problem Scott was referring to. Joel Cochran http://www.rpgnext.com On Thu, 2004-04-01 at 00:12, John King wrote: > 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 > > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (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 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.