Thank you, It is working correctly now.
>>>Since the value of I is 2 initially my cursor should Locate for page 3 initially and each time it should locate the data in Pageno 4 , 5 , 6 etc as the value of I increases by 1 each time.
>>>But Every Time cursor is halting on Pageno=2 even though the value if I is increasing to 3,4,5 etc. What is the problem ?
>
>As written, the AND only attaches to the "Itemized Calls" since AND takes priority. Use brackets around the ORs:
>
>
>LOCATE FOR ( LEFT(STREXTRACT(POS,'(',')'),10)= '- One Time' OR ;
>LEFT(STREXTRACT(POS,'(',')'),23)='- Account Level Charges' OR ;
>LEFT(STREXTRACT(POS,'(',')'),23)='Itemized Calls' );
>AND Pageno=(I+1)
>
>While you're at it- also consider using INLIST around the second two STREXTRACT() rather than repeating the STREXTRACT().
>
>Finally, since this code effectively does a table scan for each I in your for...next unless you have indexes on all the expressions, then (depending on purpose) you might consider a SQL Select to determine which pageno meet your tests.
>
>
select pageno distinct from mytable where LEFT(STREXTRACT(POS,'(',')'),10)= '- One Time' OR ;
>LEFT(STREXTRACT(POS,'(',')'),23) in ('- Account Level Charges','Itemized Calls') where pageno>2 order by pageno into cursor mycursor
Harsh