On 9/24/2013 3:08 PM, Zak Metz wrote:
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:
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.
I never imagined a tagalong sort would be a good fit in 2013.
I still don't.
This seems like a utility of some sort. If you're satisfied with the
OPNQRYF solution, consider writing a front-end that programmatically
generates those specs and compiles the CLP.
Considering the amount of work you are going to be going through to keep
the existing Cobol program unchanged, for the sake of completeness you
ought to consider the amount of work it would take to tweak the Cobol
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,
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
This mailing list archive is Copyright 1997-2013 by MIDRANGE dot 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 here. If you have questions about this, please contact