|
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Wednesday, September 25, 2013 9:34 AM
To: Midrange Systems Technical Discussion
Subject: Re: Sort input file by arbitrary position/length
I would try changing the program to reference the new logical - you might
then be able to get the original data sequence by pointing the OVR at the
original file - be worth trying. But like RPG COBOL will always read in physical
sequence if no keyed access is specified.
On 2013-09-24, at 9:54 PM, Zak Metz <Zak.Metz@xxxxxx> wrote:
Jon, sounds like you're saying I should change the Cobol. I'm assuming thefile spec will need to be different based on if the file is really keyed or not,
like RPG. That's a possibility, even if my initial plan was not to change the
Cobol. Keep in mind the input file is currently not keyed. I could generate the
DDS and compile an LF on the fly, though. Thanks for your expertise!
bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
Sent: Tuesday, September 24, 2013 3:54 PMreading in physical sequence because it has not been told it is a keyed file.
To: Midrange Systems Technical Discussion
Subject: Re: Sort input file by arbitrary position/length
I agree with Buck - the COBOL program really needs a small tweak. It is
RPG would do the same if the file were defined without the K in the F-spec.
file, or add indexing to the spec for the existing file.
You could either leave the existing file refs in place and add a new indexed
operation or anything else that uses a key) will not actually check if the key is
I suspect that the COBOL program (as long as there is no actual START
in the spot specified - but telling it to use a key will make it request the data
in keyed sequence. No guarantees as the COBOL compiler does some stuff
just to ensure ANSI compliance - and since most systems don't have
externally described files key location may be tested at run time but ...
let's say it can't.
On 2013-09-24, at 3:54 PM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:
On 9/24/2013 3:08 PM, Zak Metz wrote:
I have an existing COBOL application that cannot be changed, at least,
like so:The COBOL application accepts an input file of an arbitrary record length
determined at run time. But if I create an LF, it doesn't read it in order by key.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)
something like:What I thought I could do was use OPNQRYF to do that sorting on the fly,
That works for a file with one field. The COBOL is none-the-wiser.OPNQRYF FILE((METZ3410/PF)) KEYFLD((*MAPFLD/ZIP)) MAPFLD((ZIP
'%sst(pf 133 5)')) OPNID(C1BMNAM) SEQONLY(*NO) OPNSCOPE(*JOB)
position/length.But the input file might have multiple fields. All I know is the
without knowing what field the position/length actually falls into? I just wantIs there some way to make my MAPFLD substring the entire record
to substring the entire record.
performance hit of copying it to a single-field file. But if there were someBecause the file may be very large, I do not want to take the
other way to trick it...
takeThanks 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 program instead.
--buck
--
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
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,a moment to review the archives at
http://archive.midrange.com/midrange-l.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-ltake a moment to review the archives at
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please
http://archive.midrange.com/midrange-l.
list
________________________________
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
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
--
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 mailing list archive is Copyright 1997-2025 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.