You're probably aware but just in case you arent there's a couple of routines that might be worth taking a look at in the %SYS namespace - ^LOCKTAB and ^%IS

If REC is consistently 3 "Words" with or without the comma then this should work...

s REC="MILFORD OH 12345"

s REC=$tr(REC," ",",")

s CTY=$p(REC,","),STA=$p(REC,",",2),ZIP=$p(REC,",",3)

sticking with your original plan of using $zstrip you could also do this:

s ZIP=$zstrip(REC,"*E'N")      ; Strips Everything (*E), Except Numeric ('N) but this is a bit dodgy as if there's any other number in the string it will appear in the result

so you could try this: 

s REC="A B C,12345"

s REC=$tr(REC," ",",")     ; Translates all Spaces to commas

f x=1:1:$l(REC,",") s Bit=$p(REC,",",x) I Bit?.N s ZIP=Bit      ; This presumes that only one piece of the string is numeric and therefore that's your Zip code. (if there was more than one piece with numerics then it will use the last one) You could be more specific with the pattern match and specify it's ?1.5N (i.e. 1 to 5 Numerics)

try this...

s REC="CANTON,TX,.75103"

s ZIP=$p(REC,",",3),STA=$p(REC,",",2),CTY=$p(REC,",")

Hi Andre,

Not sure how current your post is but we specialise in warehouse management solutions and would be interested in talking to you. please send an email to and we can go from there.

Kind Regards,


I know this is an old post but it's worth mentioning in recent versions of Caché that on a tablePane object you can set a property "unlockSession" to true which stops the zen page freezing until the results are returned by the server.