× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Try this:
1. Create a permanent physical file with the same format as your existing
file, PLUS a number (10 should be good) of 32 byte (or longer if needed)
fields that will be used for sorting.
2. Build the OPNQRYF command in a CL variable with the fixed parts as a
constant, along with the FORMAT keyword to refer to your new file and the
KEYFLD keyword sorting by the new fields in your format file. For the
MAPFLD keyword, specify the sort field name and the value as %sst() .
ie: OPNQRYF FILE(MYFILE) FORMAT(MYFILE_S) QRYSLT(....) KEYFLD(KEY1 KEY2
KEY3) MAPFLD(
Then build your MAPFLD expression as another variable and concatenate the
result into a string variable that you will pass to QCMDEXC to execute.
Then, in your OVRDBF command, specify the TOFILE keyword as the FORMAT file
with SHARE(*YES).
This should give you what you want.


On Wed, Sep 25, 2013 at 3:28 PM, Paul Nelson <nelsonp@xxxxxxxxxxxxx> wrote:

+1

Paul Nelson
Cell 708-670-6978
Office 512-392-2577
nelsonp@xxxxxxxxxxxxx

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark S Waterbury
Sent: Wednesday, September 25, 2013 2:26 PM
To: Midrange Systems Technical Discussion
Subject: Re: Sort input file by arbitrary position/length

So, then, ust use FMTDTA.

> On 9/25/2013 3:17 PM, Zak Metz wrote:
I can confirm that the OPNQRYF as I presented it does work. The Cobol
reads the file by the key I specified. My problem remains, that if the
input
file is externally defined with multiple fields, I have no way to determine
within which field my desired sort position/length exists, so I can't
simple
use a position/length as in my example. Again, that works fine if the file
has a single, long field. Also to reiterate, the file itself is not keyed.
Perhaps we should not be using the term keyed, but rather emphasizing that
I
want to read the file, in Cobol, sorted by an arbitrary position/length
known only at run time.



--
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 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.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.