SELECT master INDEX on CheckAddr1Order( mas_address1 ) TO AddrOrder FUNCTION CheckAddr1Order LPARAMETERS tcAddress LOCAL lcNumericValueAfterPOBox, lcPaddedNumericValueAfterPOBox, lcReturn lcReturn = m.tcAddress && default is to return the original value IF m.tcAddress = "P. O. BOX" AND ; INLIST( SUBSTR( SUBSTR( m.tcAddress, 11 ), 1, 1 ), "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ) ** we have a PO BOX followed by a numeric value - get it and pad left to make a 10 character length lcNumericValueAfterPOBox = GETWORDNUM( m.tcAddress, 4, [ ,-] ) lcPaddedNumericValueAfterPOBox = PADL( m.lcNumericValueAfterPOBox, 10 ) lcReturn = PADR( STRTRAN( m.tcAddress, m.lcNumericValueAfterPOBox, m.lcPaddedNumericValueAfterPOBox ), 30 ) ENDIF RETURN m.lcReturnYou were a fantastic help...thanks again!
>PADL(VAL(GETWORDNUM(mas_address1,4)),10)+GETWORDNUM(mas_address1,5) >>HTH,