Q

Getting the RRN value to decrease by one

I'm accessing a keyed PF using RRN (RECNO). Suppose the PF has initially 9 records. I am adding a record in this PF after using the INZPFM command, since you can't add records in a PF accessed by RRN unless the RRN already exists in the PF. Now the value of the RRN is 10.

When I delete a record, the number of records in the PF is 9, but the value of RRN is still 10. What I need is this: When I delete a record in this PF, the RRN value should get decremented by 1, i.e. equal to the number of record in the PF. This is not happening right now. The RRN does not get decremented. I would appreciate it a lot if someone could help me in achieving this.


You must change your physical file to reuse deleted records value to *YES and Force Ratio to 1. Beware that if you delete record 4 and there are 9 records in the file, it is possible that the next record could be 4 and equally possible that the record number could be 10 depending on how the operating system handles the file. You should check the language reference (RPG/Cobol/C) and read about record blocking and the FEOD opcode to force the records to disk.


This was first published in April 2001

Dig deeper on iSeries CL programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close