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



If you can, add a key field to the file. Maintain it with a trigger
program.

On Wednesday, September 25, 2013, Lance Gillespie wrote:

Like an Address out sort?

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx <javascript:;> [mailto:
midrange-l-bounces@xxxxxxxxxxxx <javascript:;>] On Behalf Of Booth Martin
Sent: Wednesday, September 25, 2013 1:34 PM
To: Midrange Systems Technical Discussion
Subject: Re: Sort input file by arbitrary position/length

Have you considered something like this:

Create a new work file defined with a key field of say, 150 columns and
then another field for the RRN of your main file. Then add a new process
which, when called, populates your new work file.


On 9/25/2013 3:09 PM, Zak Metz wrote:
Assuming there's an easy way to get the list of fields in the input
file, I believe I can do this with 2 mapped fields:

OPNQRYF FILE((METZ3410/PF2)) KEYFLD((*MAPFLD/ZIP)) +
MAPFLD((ONEBIGFLD 'pf2f1 *cat pf2f2 *cat +
pf2f3') (ZIP '%sst(onebigfld 133 5)')) +
OPNID(C1BMNAM) SEQONLY(*NO) OPNSCOPE(*JOB)

However, if any of the fields I'm concatenating are not strings, I'm
thinking the offsets could change between the actual physical file and my
concatenated representation, so the user-provided offset of 133, length of
5 might have shifted. In fact, I don't think I can simply concatenate
numeric fields to a string.

Looks like I'm at a dead end. Unless I'm willing to make a copy of the
input file, I don't see any way to sort it. If there were just a way to
view the file as one long record regardless of its actual external
description, I could do it with OPNQRYF.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx <javascript:;>
[mailto:midrange-l-bounces@xxxxxxxxxxxx <javascript:;>] On Behalf Of
Jeff Young
Sent: Wednesday, September 25, 2013 2:50 PM
To: Midrange Systems Technical Discussion
Subject: Re: Sort input file by arbitrary position/length

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.

________________________________


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx <javascript:;> To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx <javascript:;> 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 <javascript:;>
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx <javascript:;>
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 ...

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.