Thanks Terry!

After looking at your example, the fog started lifting .... I'm pretty
certain that this is exactly what I was looking for.



Winchester Terry wrote:

You need to check the I-O feedback area after each
START/READ statement. Here's a copybook that I
created a long time ago:

* COBOL I-O FeedBack Area (See AS/400 Data Management Guide) *
* Note: To use this you must have the following entry under *
* *
* *
* Then retrieve the file information IMMEDIATELY after *
* your last file I/O statement (READ, WRITE, etc.) as *
* follows: *
* *
* accept ioa-area from if-area. *
* move ioa-rcdlen to my-rcdlen. *
* *
* *
* /v5r3/index.jsp?topic=/dm/rbal3dbiof.htm *
* *
* *
* /v5r3/index.jsp?topic=/dm/rbal3pddio.htm *
* *

01 ioa-area global.

*---- Common I/O Area
03 ioa-common-area.

* Offset to File Areas
05 ioa-offset pic s9(04) comp-4.
* Write Operation Count
05 ioa-writcnt pic s9(09) comp-4.
* Read Operation Count
05 ioa-readcnt pic s9(09) comp-4.
* Write/Read Oper. Count
05 ioa-wrtrdcnt pic s9(09) comp-4.
* Other Oper. Count
05 ioa-othercnt pic s9(09) comp-4.
* Reserved
05 ioa-filler1 pic x(01).
* Current Operation
05 ioa-crntopn pic x(01).
88 blk-read value x'01'.
88 read-direct value x'02'.
88 read-key value x'03'.
88 blk-write value x'05'.
88 write-read value x'06'.
88 update-opn value x'07'.
88 delete-opn value x'08'.
88 force-eod value x'09'.
88 force-eov value x'0A'.
88 reles-rcd value x'0D'.
88 chg-eod value x'0E'.
88 put-delete value x'0F'.
88 reles-devc value x'11'.
88 acq-devc value x'12'.
* Record Format Name
05 ioa-rcdname pic x(10).
* I/O Device Class
05 ioa-devclass pic x(02).
* I/O Device Name
05 ioa-devname pic x(10).
* Last I/O Record Len
05 ioa-rcdlen pic s9(09) comp-4.
* Reserved
05 ioa-filler2 pic x(80).
* Blocked Record Count
05 ioa-blkcnt pic s9(04) comp-4.
* Record Format Len
05 ioa-rcdfmtlen pic s9(04) comp-4.
* Reserved
05 ioa-filler3 pic x(02).
* Current Block Count
05 ioa-crntblk pic s9(09) comp-4.
* Reserved
05 ioa-filler4 pic x(08).

*---- Database I/O Area
03 ioa-database-area.

* D/B Feedback Area Size
05 ioa-dbsize pic s9(09) comp-4.
* Join File Data
05 ioa-jfile pic x(04).
* I/O Offset to Null Key
05 ioa-nullset pic s9(04) comp-4.
* Nbr of Locked Rcds
05 ioa-lockcnt pic s9(04) comp-4.
* Nbr of Fields
05 ioa-fldcnt pic s9(04) comp-4.
* Offset to Error Bit
05 ioa-errbit pic s9(09) comp-4.
* Get-Next File Pos.
05 ioa-getnext pic x(01).
* Delete Indicator
05 ioa-deleted pic x(01).
* Key Fld Cnt (Binary)
05 ioa-keycnt pic s9(04) comp-4.
* Number of Key Fields
* (added 06/10/08 TMW)
05 ioa-keyflds pic x(01).
* Reserved
05 ioa-filler5 pic x(04).
* Key Length
05 ioa-keylen pic s9(04) comp-4.
* Data Member Nbr
05 ioa-datanbr pic s9(04) comp-4.
* Relative Record Nbr
05 ioa-dbrrn pic s9(09) comp-4.
05 filler pic x(45).

*---- Display File I/O Area

03 ioa-terminal-area redefines ioa-database-area.
* See the DM Guide
05 ioa-flag-bits pic x(02).
* Function Key (Hex)
05 ioa-pfkey-id pic x(01).
* Cursor Location (Hex)
* in Line/Column Format
05 ioa-cursor-pos pic x(02).
* Data Stream Length
05 ioa-data-len pic s9(09) comp-4.
* Subfile RRN
05 ioa-sfl-rrn pic s9(04) comp-4.
* RRN Current Displayed
05 ioa-crnt-rrn pic s9(04) comp-4.
* Total Records in SFL
05 ioa-sfl-size pic s9(04) comp-4.
* Cursor Location (Hex)
* within Active Window
05 ioa-wcursor-pos pic x(02).
* Reserved
05 ioa-filler6 pic x(17).
* Major Return Code
05 ioa-major-rtn pic x(02).
* Minor Return code
05 ioa-minor-rtn pic x(02).
* ICF SNA Sense Return Code
05 ioa-sna-sense pic x(08).
* ICF Safe Indicator
05 ioa-safe-ind pic x(01).
* Reserved
05 ioa-filler7 pic x(01).
* ICF Request Write Command
05 ioa-rqst-write pic x(01).
* ICF Record Format Name
05 ioa-icf-recname pic x(10).
* Reserved
05 ioa-filler8 pic x(04).
* ICF Mode Name
05 ioa-icf-modname pic x(08).
* Reserved
05 ioa-filler9 pic x(09).

*---- Printer File I/O Area

03 ioa-printer-area redefines ioa-database-area.
* Current Line No.
05 ioa-line-nbr pic s9(04) comp-4.
* Current Page Count
05 ioa-page-nbr pic s9(09) comp-4.
* Spool File has been deleted
* (added 06/10/08 TMW)
05 ioa-splf-deleted pic x(01).
* Reserved
05 ioa-filler10 pic x(27).
* Major Return Code
05 ioa-prt-major pic x(02).
88 prt-complete value '00'.
88 prt-file-err value '80'.
88 prt-dev-err value '81'.
88 prt-open-err value '82'.
88 prt-rcvy-err value '83'.
* Minor Return Code--See the
* Print Device Pgm'ing Guide
05 ioa-prt-minor pic x(02).

Terry Winchester
The Raymond Corporation

-----Original Message-----
From: cobol400-l-bounces@xxxxxxxxxxxx
[mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rich Loeber
Sent: Friday, November 07, 2008 1: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

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


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

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