|
And again, my contribution: I have been working on exactly the same problem. Code follows. Is this too complicated? It gives them exactly what's wrong... (Could be different requirements sometimes). INV# is the field. I pick up DTATYP, DTLEN(C) from a control file after determining the value is required given certain data conditions, then: * - Check for blank invoice number (make sure it's there) C when inv# = blks C eval *in56 = *on C eval scmsg = 'Inv-# must be entered for this vendor' * - Left-justified. (I could internally left-0justify, but for xyz reasons did not) C when %subst(inv#:01:01) = blk C eval scmsg = 'Inv-# must be left-justified. * - Length: I check the length after stripping off the leading and trailing blanks C when %len(%trimr(inv#)) <> ctlinvlen C eval scmsg = 'Inv# for this vendor requires ' + DTALENC + ' digits' * - Make sure it's numeric. C when DTATYP = 'NUM' C digits check inv# xa This gives the position of the first non-digit, where DIGITS = '0123456789'. The resulting position XA should be zero if the length required is the same as the length of the field, or else it cannot C if xa <> 0 and xa < %len(%trim(inv#)) or xa = 0 and DTALEN <> %len(inv#) C eval scmsg = 'Inv-# for this vendor - C requires digits, 0 trhough 9 only' C endif C endsl ----- Original Message ----- From: "Graves, Chuck" <cgraves@roddapaint.com> To: <midrange-l@midrange.com> Sent: Tuesday, July 09, 2002 4:04 PM Subject: string editing suggestions > > > I have a need to edit/validate a 23 character field, with the following: > > 1) numeric only... easy enough with TESTN OP Code > > 2) minimum of 6 characters ... easy enough by finding the position of > the first blank character etc. > > 3) testing for non-repetitive characters (i.e. maximum of x number of > the same digits keyed...not necessarily consecutive) AND, x is based on > HOW MANY characters were keyed within the 23 character string. > > Anyone got any slick routines for #3 > > TIA > > Chuck Graves > Rodda Paint Co. > _______________________________________________ > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l > or email: MIDRANGE-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l. > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.