I've never used relative record number in COBOL. I'd like to know if
that's possible myself.

If it's not possible to use relative record number, you have some other
options:

(1) Is there a non-key field in the file that reliably distinguishes
records with the same key field values? If so, pass the key fields plus
the non-key field to the second program. Have the second program start
on the key values, then read and compare the value of the non-key field
with the value passed in as a parameter.

(2) Create a new field in the file. The first program puts a value in
that field and rewrites it to "mark" it as the record to be processed.
Pass the key values to the second program, then have the second program
start and read until it sees the value in the new field. (You could also
adopt an unused field in the file for this purpose.)

(3) Use a counter. The first program sets the counter to zero and starts
on the file. With each read, the program increments the counter by one.
Pass the same start values and the counter value to the second program.
The second program starts in the same place and performs the same number
of reads (via counter value). Of course, for this to be reliable, the
file should not be manipulated (e.g., records added or deleted) while
the programs run.

Hope these give you some ideas.

-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rich Loeber
Sent: Friday, November 07, 2008 12:52 PM
To: COBOL Programming on the iSeries/AS400
Subject: [COBOL400-L] Getting Relative Record Number After READ

I have a file that I am reading dynamically either forward, backwards
or
by first setting the START command. The file is indexed, but has the
capability of containing duplicate keys. After each read, I would
like to
get at the exact relative record number of the record just read. I
seem
to recall doing this some years ago, but the gray matter has lost it
altogether. I've been searching the IBM COBOL manuals to no avail.
I
need to know the exact record as I am calling another program that
then
needs to retrieve that exact same record, so passing just the record
key
will not work.

All suggestions appreciated.

Rich Loeber
Kisco Information Systems
http://www.kisco.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 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.