|
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
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.