Highlighted
New Member.
84 views

ISAM Index file :- RM/COBOL READ using Alternate Record Key

Trying to read ISAM file via RM/COBOL [In Linux RedHat] and writes in output file. Detail Below : 

#   Start key is Alternate Record key = Non-Contiguous Split key.  [ Can contain duplicates] 

#   Read Next. 

Read Next is resulting in records in below order. [Prime Key is Numeric in file].

a. Prime Key 2

b. Prime Key 1

c. Prime Key 500 and so on..

 Output file has records with same Alternate key.Records are not ordered on Prime key.

Questions :

a. How the records are ordered ? Are the records are ordered on Add/Update Date/Time in file or any other?

b. I want record to be ordered on Prime Key. Is  this could be accomplished via changed in some Configuration setting ? 

c. Is there any other document to refer other than Language/User reference for detail about Alternate Record key?

0 Likes
1 Reply
Highlighted
Knowledge Partner
Knowledge Partner

Re: ISAM Index file :- RM/COBOL READ using Alternate Record Key

"How the records are ordered ? Are the records are ordered on Add/Update Date/Time in file or any other?"

The ISO Standard for COBOL requires that alternate keys with duplicate values are to be retrieved in temporal order.  This is described in the RM/COBOL Language Reference as, "The order of retrieval from a set of records that have duplicate key of reference values is the original order of arrival of those records into that set."

"I want record to be ordered on Prime Key. Is  this could be accomplished via changed in some Configuration setting ?"

If you have the liberty of changing the SELECT sentence for the file, you may simply add the prime key data item(s) at the end of the split alternate key and rebuild the file.  If you are forced to accept the file 'as is' then you could use a SORT statement with input and output procedures, or if you are assured that the set of values is limited you could do a simple insertion sort into a table of the (unique) prime key values; at the end of the duplicate sequence, use the table to read the records using the prime key.

There is no configuration setting that can do this.

"Is there any other document to refer other than Language/User reference for detail about Alternate Record key?"

There is the ISO Standard.  It gives all the rules, but may be less readable than you desire.  Almost any decent COBOL textbook would give extensive coverage of indexed files.  The RM Language Reference Manual is very thorough.

 


Tom Morrison
Consultant

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.