|
Like most user-requirements, the original poster of this note, didn't give specifics, just a generalized statement. I doubt however, that people actually enter the state as the full word since most people have trouble spelling the appreciations let alone the full state names. I'm not sure if CHECKR is what you'd want either, since it would eliminate Canadian postal codes which include alpha characters as well as numbers, and usually a space. In this case, what we really need is the SCANR (scan reverse) which was supposed to be in the first release of RPG IV, but didn't make the cut, and we're still waiting on it. But thank goodness we have two ways to do the CHECKR operation (CHECKR and %CHECKR). <g> Bob Cozzi cozzi@rpgiv.com Visit the new on-line iSeries Forums at: http://www.rpgiv.com/forum > -----Original Message----- > From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com] On > Behalf Of Mackie, Roger L. (Precision Press) > Sent: Thursday, August 30, 2001 7:19 AM > To: 'rpg400-l@midrange.com' > Subject: RE: Data manipulation > > Bob's suggestion might not work well for North Carolina, New York, etc. You > might try the CHECKR Opcode (or %CHECKR function if you have V5R1). You > would need to invoke it twice, once from the end of the field and then from > the first non-blank position the first CHECKR found. > > As previous posters have pointed out, if the zip code is in the last > position, or abuts the state without a blank, the logic gets much more > complicated. > > Roger Mackie > > -----Original Message----- > From: Bob Cozzi (RPGIV) [mailto:cozzi@rpgiv.com] > Sent: Wednesday, August 29, 2001 7:42 PM > To: rpg400-l@midrange.com > Subject: RE: Data manipulation > > ... > Then, Scan for a blank, like this: > Eval pos = %Scan(' ' : StZip) > If Pos > 0 > Eval state = %Subst(stzip:1:pos-1); > Eval zip = %subst(stZip: pos + 1) > Eval zip = %Trim(zip) > Endif > ... > > > > > > Does anyone have a slick way of extracting the postal code? > > > > > > The postal code could be US or Canadian..... > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l > or email: RPG400-L-request@midrange.com > 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.