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



But the OP said he didn't want to copy the file due to its size and this would either produce a new file or destroy the original sequence as well as use a lot of disk space (temporarily) for work files.


On 2013-09-24, at 4:05 PM, Winchester Terry <terry.winchester@xxxxxxxxxxxxxxx> wrote:

Although everyone else on here might cringe at this suggestion,
FMTDTA may also be a solution for you. You can specify sorting
of specific positions within a source member. Something like
this in your CL program:

FMTDTA INFILE((*LIBL/MS005W1)) +
OUTFILE(SPARCS/MS005S1) +
SRCFILE(*LIBL/QFMTSRC) SRCMBR(SORTMES1) +
OPTION(*NOPRT)

with the corresponding source member from QFMTSRC:

* The header specifies a total
* sort field length of 62 chars
* ascending and omit output of
* the control field (X).
HFILE 62A X
* The field specifies a total
* sort field length of 62 chars
* ascending and omit output of
* the control field (X).
FNC 493 554 MESKEY
FDC

Just a thought...

Terry

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Zak Metz
Sent: Tuesday, September 24, 2013 3:09 PM
To: MIDRANGE-L@xxxxxxxxxxxx
Subject: Sort input file by arbitrary position/length

I have an existing COBOL application that cannot be changed,
at least, let's say it can't.
The COBOL application accepts an input file of an arbitrary
record length like so:
SELECT C1BMNAM
ASSIGN TO DISK-C1BMNAM
FILE STATUS C1BMNAM-FILE-STATUS
.
I want it to process the file sorted by a certain
position/length (ZIP Code) determined at run time. But if I
create an LF, it doesn't read it in order by key.
What I thought I could do was use OPNQRYF to do that sorting
on the fly, something like:
OPNQRYF FILE((METZ3410/PF)) KEYFLD((*MAPFLD/ZIP)) MAPFLD((ZIP
'%sst(pf 133 5)')) OPNID(C1BMNAM) SEQONLY(*NO) OPNSCOPE(*JOB)
That works for a file with one field. The COBOL is none-the-wiser.
But the input file might have multiple fields. All I know is
the position/length.
Is there some way to make my MAPFLD substring the entire
record without knowing what field the position/length
actually falls into? I just want to substring the entire record.
Because the file may be very large, I do not want to take the
performance hit of copying it to a single-field file. But if
there were some other way to trick it...
Thanks in advance for any and all suggestions.

Zak Metz, Principal Software Engineer
Pitney Bowes Software
1664 Princess Ln | Frisco TX | 75034-8715 | USA
507-384-9069 | www.pb.com<http://www.pb.com/>
zak.metz@xxxxxx<mailto:zak.metz@xxxxxx>

Every connection is a new opportunity(tm)


________________________________

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


Confidentiality Notice:

The preceding e-mail message (including any attachments) contains information that may be confidential, protected by applicable legal privileges, or constitute non-public information. It is intended to be conveyed only to the designated recipient(s). If you are not an intended recipient of this message, please notify the sender by replying to this message and then delete it from your system. Use, dissemination, distribution or reproduction of this message by unintended recipients is
not authorized and may be unlawful.



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


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





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.