|
If all you're doing is reading the file in the sequence generated by the
OPNQRYF, then you should be able to code it for sequential organization
and access. Then you won't have to be concerned about the RECORD KEY
clause.
SELECT HISTRY4 ASSIGN TO DATABASE-HISTRY4
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS FILE-STATUS-01.
Your open query file will hand the records to your COBOL program in HITEM,
LMRKTC sequence.
Original message:
----------------------------------------------------------------------
date: Mon, 15 Mar 2004 11:20:07 -0500
from: rick.baird@xxxxxxxxxxxxxxx
subject: [COBOL400-L] reading a file organized by OPNQRYF
Just another quick question from a guy who'd really rather not have to
fart
around with this stuff.... :) I'm converting a bunch of flat file FMTDTA
stuff to use OPNQRYF instead.
when reading a file in cobol that's been sorted via opnqryf, is there
anything I need to worry about as far as COBOL syntax?
this is what I have:
OVRDBF FILE(HISTRY4) SHARE(*YES)
OPNQRYF FILE((HISTRY4)) QRYSLT( +
'HPEROD *EQ ' *CAT &PERIOD *BCAT +
'*AND LMRKTC *NE "00" +
*AND HITEM *NE 0') +
KEYFLD((HITEM) (LMRKTC))
and in my cobol:
SELECT HISTRY4 ASSIGN TO DATABASE-HISTRY4
ORGANIZATION IS INDEXED
ACCESS MODE IS SEQUENTIAL
RECORD KEY IS EXTERNALLY-DESCRIBED-KEY
FILE STATUS IS FILE-STATUS-01.
OPEN INPUT HISTRY4
READ HISTRY4 AT END
MOVE "Y" TO EOF-HISTRY4.
CLOSE HISTRY4
If I'm missing something obvious, I'd appeciate the heads up - I'm
particularly concerned about the ACCESS MODE and RECORD KEY clauses of the
SELECT Statement. - indexed, sequential with external key - (not the
file's natural key)
I'm changing a ton of these, and I won't have a chance to test till I'm
done, and I'd like to get it right the first time.
Thanks a ton,
Rick
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.