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



Joel,

I think Jeff is right. Using OPNQRYF with COBOL sequential access, the records will be presented to the program in the order of the keys used in the OPNQRYF.

It has been a long time ago, but this is one of the techniques we used to make Sys/36 programs work on the AS400. Those RPG2 or COBOL programs had none of the key extensions. We converted the $GSORT specs to OPNQRYF and recompiled the original source. Programs read the files as if they were physically sequenced.

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of Stone, Joel
Sent: Wednesday, September 25, 2013 9:41 AM
To: Midrange Systems Technical Discussion
Subject: RE: Sort input file by arbitrary position/length

No I don't think that is accurate (but I have been wrong before :)

Your stmt is accurate ONLY if the file is described in the COBOL source as
"ORGANIZATION IS INDEXED" and "RECORD KEY IS ..."

The RPG equivalent of "K" in the right spot for a file spec.

But his COBOL pgm has the file defined WITHOUT a key, so I am pretty sure it
will read it in the arrival sequence REGARDLESS of any keys or overrides.




-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Wednesday, September 25, 2013 9:34 AM
To: Midrange Systems Technical Discussion
Subject: Re: Sort input file by arbitrary position/length

Joel,
By using the OVRDBF command with SHARE(*YES), the COBOL program will
read
the file using the Access Path created by the OPNQRYF.



On Wed, Sep 25, 2013 at 10:24 AM, Stone, Joel <Joel.Stone@xxxxxxxxxx>
wrote:

Have you actually tried this? I don't think that this will work as you
are proposing.

When you run OPNQRYF, if creates the equivalent of a temp LF. When
COBOL
reads this temp LF, it will read it as a PF (assuming no changes to the
COBOL pgm to access C1BMNAM by key).

You would have to do CPYFRMQRYF after the OPNQRYF to order the
physical
data - then the COBOL pgm would read in the sequence that you desire.

If the requirement is to NOT touch the COBOL pgm, then the physical data
must be re-ordered. I would expect FMTDTA to be faster than
OPNQRYF/CPYFRMQRYF or any other method.

But, it is so simple to change the COBOL to read an indexed file. Maybe
there are other constraints which require no changes to the COBOL.

Another option is SQL to re-order the data.

I don't see how OPNQRYF or LF or any kind of index will get you there.





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.