|
If you only have to "tokens" in this 36-position field (where's the city being entered?) then it should be a matter of extracting both of these tokens into individual fields and looking at the data in these fields to determine if it is a valid STATE. If it isn't then check it for valid ZIP/Postal code syntax. Start with: STZIP = "IL 60606" End with: STATE="IL" ZIP="60606" To do this, first trim off the left-side blanks using %TRIML like this: Eval STZIP = %TrimL(STZip) 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 At this point you should have the State and ZipCode in the two fields. Of course I just ad hoc coded this stuff, so it might not be perfect. <g> Bob Cozzi www.rpgiv.com/forum > > Hi: > > > > I have a free-form 36 position field with a state and postal code (but > > since its not edited I don't know where in the field).. > > > > Does anyone have a slick way of extracting the postal code? > > > > The postal code could be US or Canadian.....
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.