Joel,
You can always utilize a user index assuming each record is no more than 2000 characters in length. The program just needs enough authority to use the User Index APIs.
Basic steps are...
1. Create a user index in QTEMP and key it in the sequence you want things sorted.
API is QUSCRTUI.
2. Read your work file and write entries to your user index.
API is QUSADDUI.
3. Clear your work file.
4. Read the user index and write records to your work file.
API is QUSRTVUI.
Now your work file is sorted in the sequence you desired.
HTH,
Gary Monnier
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Stone, Joel
Sent: Thursday, January 24, 2013 7:33 AM
To: midrange-l@xxxxxxxxxxxx
Subject: RE: take 2: how to sort a file in place
Good suggestion. But with all the security and authority issues these days - and prod running on different h/w that developers don't even have access to - is there an easy way to ensure that the new file has EXACTLY the same authority and security attributes as the old one? Does CRTDUPOBJ supply all the necessary duplication?
With CPYF, I know for sure that the data is ending up where it came from!
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Wednesday, January 23, 2013 5:04 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: take 2: how to sort a file in place
On 2013-01-23, at 2:26 PM, midrange-l-request@xxxxxxxxxxxx wrote:
Can this be done in one SQL statement with the result placed back in WORKFILE1?
Or should I create a new table QTEMP/WORKFILE2 using DISTINCT or GROUP BY, and then CPYF back to WORKFILE1.
Another option being to create a new file delete the old one and either move or rename the new one to the old name. Neither move or rename would actually move the data so both should be more efficient than copying the new on back again.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
________________________________________________________________________
This inbound email has been scanned for all viruses by the MessageLabs SkyScan
service.
________________________________________________________________________
______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs Skyscan service.
For more information please visit
http://www.symanteccloud.com
______________________________________________________________________
As an Amazon Associate we earn from qualifying purchases.