[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Select string



Ben,  you may try this.  It seems to work for me.

begin-program
do it
end-program

begin-procedure it
  let #len = 13
! let $str_var = 'book 2000 20-sep-01 purchase card $20,000'
   let $str_var = 'invoice purchase card $25.50 account payable'
  find 'purchase' in $str_var 1 #loc
  show 'location: ' #loc
  let #start = #loc +1
  let $p_card = substr($str_var, #start, #len)
  let $p_card = '*'||$p_card||'*'
  show 'Substring: ' $p_card
end-procedure

- Antonio

At 12:50 PM 10/29/01 -0800, you wrote:
>I am reading a flat data file. For each line in the data file I would like
>to select only the word 'purchase card'. It seems simple to do. But I can't
>figure out how to do it in SQR. Help please!
>exp:
>book 2000 20-sep-01 purchase card $20,000
>invoice purchase card $25.50 account payable
>...
>'purchase card' word is not always in the same column of the data file.
>Thanks in advance.