|
TESTD... what about> monitor; dateField = %date(numeric: }format); on-error xxx; etc.... ______________________________________________________ Simon Coulter escribió: > Hello Rob, > > You wrote: > >Having IBM do the trivial sometimes comes up with some better idea's. > > Not always :) > > >For example, everyone had a set of date routines for dealing with > >numeric numbers. However I like the functionality of true date fields > >much better. > > This is not a good example. Dates, times and timestamps were implemented > in the database therefore they become accessible to any data processor > (Query, SQL, HLL, etc.) therefore it makes sense to provide built-in > support for those data types. (But look at how many systems **still** > use numeric 'dates' thus requiring the language to support conversions > when we should be using the native types.) > > What I object to is the seemingly endless requests for Toronto to provide > trivial RPG IV specific functions whose sole purpose seems to be to > provide a BIF to replace an op-code so free-form RPG looks better by > avoiding the switches out of /free and in again. Hence my comment that > the proposed %TESTD, %TESTT, %TESTZ functions are a waste of Toronto's > time and money because: > > D testDate PR 1N > D aDate 10 > D aFormat 10 > > P testDate B EXPORT > D testDate PI 1N > D theDate 10 > D theFormat 10 > > D validDate S 1 INZ(*ON) > > C SELECT > C WHEN ( theFormat = '*YMD' ) > C *YMD TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*MDY' ) > C *MDY TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*DMY' ) > C *DMY TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*CYMD' ) > C *CYMD TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*CMDY' ) > C *CMDY TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*CDMY' ) > C *CDMY TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*JUL' ) > C *JUL TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*ISO' ) > C *ISO TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*USA' ) > C *USA TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*EUR' ) > C *EUR TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = '*JIS' ) > C *JIS TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = $LONGJUL ) > C *LONGJUL TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C WHEN ( theFormat = $JOBRUN ) > C *JOBRUN TEST(DE) theDate > C EVAL validDate = NOT(%ERROR) > C OTHER > C EVAL validDate = *OFF > C ENDSL > > C RETURN validDate > > P testDate E > > took 15 minutes to code and verify with the reference manual and allows > me to code: > > C IF testDate( birthDate ) > or > C IF NOT(testDate( birthDate )) > or > C EVAL validDate = testDate( birthDate ) > > Of course, if variables were allowed in Factor-1 for the TEST(x) > functions it would be simpler still. Wack that function in a service > program, shove that in a binding directory, name the binding directory on > a common H-spec that is /COPYed into the program template, and we have an > instant new language extension. > > This example needs testing and possible additional support for *YYMD, > *MDYY, *DMYY, etc. Consider it open source; if someone creates the > corresponding time and timestamp (really easy) functions we'll be done > and Toronto can concentrate on complex things. The same thing could have > been done with the date duration BIFs and there are other examples such > as ALLOC. > > Having said that, perhaps Toronto do have something grander in mind but > that doesn't change the essence of my proposal which is to improve the > LANGUAGE rather than the code. If the language improves the code will > too. Toronto have given us the ability to extend the language via > procedures so let us stop asking them to do the stuff we can do for > ourselves. > > Regards, > Simon Coulter. > --------------------------------------------------------------------
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.