|
This is the way that I would do this, first ensure your file is defined correctly: select TF00D assign to database-TF00D access is dynamic organization is indexed record key is externally-described-key File status is xxx-status. Then do a START on your detail file using the key values from your header file: move OHORG to ODORG move OHTOOR to ODTOOR start TF00D key >= externally-described-key invalid key Perform End-Of-File-Logic end-start Then read each record to ensure your keys match. When they don't match...your done... read TD00D next at end Perform End-Of-File-Logic end-read if OHORG = ODORG and OHTOOR = ODTOOR Perform Good-Record-Logic else Perform End-Of-Key-Logic end-if Note that you will only be reading the keys that match (ORG,TOOR) in both files - this should be very quick. Terry Winchester Programmer/Analyst ________________________________ The Raymond Corporation terry.winchester@xxxxxxxxxxxxxxx > -----Original Message----- > From: > cobol400-l-bounces+terry.winchester=raymondcorp.com@xxxxxxxxxx > om > [mailto:cobol400-l-bounces+terry.winchester=raymondcorp.com@mi drange.com] On Behalf Of Don Stafford > Sent: Monday, March 20, 2006 9:21 AM > To: COBOL Programming on the iSeries/AS400 > Subject: [COBOL400-L] Database File I-O > > Cobol Newbie question........... > > I am reading files created thru DDS in an RPG environment. > > When the COPY command is executed during my ILE Cobol > compile, I get the > following: > > *THE KEY DEFINITIONS FOR RECORD FORMAT TFOOD00 > * NUMBER NAME RETRIEVAL ALTSEQ > * 0001 ODORG ASCENDING NO > * 0002 ODTOOR ASCENDING NO > * 0003 ODTOLN ASCENDING NO > 05 TFOOD00. > 06 ODORG PIC X(3). > 06 ODPLN PIC S9(9) > COMP-3. > 06 ODSWHS PIC X(3). > 06 ODORTP PIC X(3). > 06 ODTOLN > PIC S9(7) COMP-3. > 06 ODTOOR > PIC S9(9) COMP-3. > 06 ODSHOR > PIC S9(9) COMP-3. > ..... etc .... > I have another file, TFOOH, that is the 'driver' file. Once > I find a record > in the TFOOH, I then want to access all the associated > records in the TFOOD. > I have OHORG and OHTOOR fields in the TFOOH which can be used > to point to > the correct set of records in the TFOOD. > > My question is, how do I do a START on the TFOOD file, so that I am > positioned to the 1st record I want. > > If I had defined the file myself, I would have a key setup as: > > 06 TFOOD-KEY. > 07 ODORG > PIC X(3). > 07 ODTOOR > PIC S9(9) > COMP-3. > 07 ODTOLN > PIC S9(7) > COMP-3. > > Then I could populate the 1st 2 fields and do a START NOT < TFOOD-KEY. > But since these are not group, how do I do it in ILE COBOL? > I do not want to START on the ORORG and READ until I finally > get a hit.... > there are 10000s of records. > > Thanks for any help!!! > > -------------------------------------------------------------- > ---------- > Don Stafford, Director of Information Technologies > UAV Entertainment Corporation > 2200 Carolina Place > Fort Mill, SC 29708 > 803-548-1056 x1159 > 803-548-2493 - Fax > don.stafford@xxxxxxxxx > > > -- > This is the COBOL Programming on the iSeries/AS400 > (COBOL400-L) mailing list > To post a message email: COBOL400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/cobol400-l > or email: COBOL400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/cobol400-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.
As an Amazon Associate we earn from qualifying purchases.
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.