Hi Talkturkey ,
The order in DDS is TKOPNC, TKOPNY, TKOPNM, and TKOPND. TKOPNC is at posiontion 491-492 and the rest followed right after.
D OPNDAT 6 OVERLAY(TKREC:493)
I only use the overlay field, OPNDAT, for printing on the report. It's not part of record selection. And for testing purpose, I did not manipulate OPNDAT at all. I just code it on the 'O' spec as one of my column in the report. So I don't see any relation with the wrong order.
SQL vs. native read
My file has almost 700,000 records. I copied this pgm and modified to use native read instead and found that native read is alot faster. My file has a key TKOPNC, .Y,.M,.D.
Is it the way I coded my SQL? Any thing that you see can be improved?
Thanks