|
1) James, Joel - thanks for the links. There is some great stuff on your sites. One of my as-time-allows projects is to write a procedure to assist our operators when scheduling jobs: given a 'projected complete' date and a 'days prior' value it will return the necessary start date (respecting weekends and holidays). I'll be glad to donate the code when it is complete. 2) Scott - thanks for the ideas. Since most data arrives as .xls and can be in varying formats, we've been using StrPcCmd to pass the data through Excel and save it to the IFS with the help of some VB code. Excel allows the operators to view, re-arrange columns and format cells prior to using CpyFrmStmf to populate a work-file in qsys.lib which is fed to a batch validation/posting routine. All this occurs within one CL and actually works pretty smoothly and quickly, but I was hoping to remove some of the manual intervention. I was wondering how other folks have handled similar situations. Given the variability of the input, it may not be possible to simplify the import process any further. Excel is made for just that sort of data manipulation and it makes no sense to try to duplicate it with an RPG subfile. I may enhance the date checking with CEEDAYS, though. One of these days I'll finish implementing those RPG/POI routines and just read the .xls directly into RPG... JK <snip> date: Thu, 01 Apr 2004 10:23:52 +0000 from: Joel Cochran <jrc@xxxxxxxxxx> subject: Re: Date validation of different formats in RPG 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 >
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.