>>>I was writing a common routine that would make a copy of any cursor. Input cursors would have different structures and might have an active index. The records in the copy of the cursor have to be in the same order as they are in the cursor (with respect to any active index).
>>
>>How about something like: SELECT * FROM sourcetable ORDER BY KEY(TAGNO('cust_id'))
>
>It wants a name, and wont take a name expression, so use:
>
>
>cOrder = KEY(TAGNO('cust_id','sourcetable'),'sourcetable')
>SELECT * FROM sourcetable ORDER BY &cOrder
And, to account for multiple field keys:
cOrder=strtran(key(tagno('cus_id','sourcetable'),'sourcetable'),"+",",")
Imagination is more important than knowledge