Insert record in subfile

pts.
Tags:
RPG
RPGLE
How to code insertion on a new receord between 2 existing recods in a subfile ? I want to code something like a expand tree : I READC my subfile and when option code value is ... I want to add some records between current & next subfile record

Answer Wiki

Thanks. We'll let you know when a new response is added.

I don’t believe it can be done without building the subfile again. Maybe someone else has an idea but I would just rebuild the subfile.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • astradyne
    The way I would do it would be to use a Keyed User Index and a page-at-a-time (SFLSIZ = SFLPAG) sufile. The first time I load the subfile I would write the records to a user space as well. If the user pages down then I would load the next page (overwriting the existing page) and add the records to the end of the User Index. If the user inserts a record then I would load it into the User Index with an appropriate "key" and then reload the subfile starting with the currently top record. If the user pages up then I would calculate how far back up the User Index I would have to go and reload the subfile from there. Depending on how many records you expect to insert between subfile records then you may need to renumber the user index keys each time. Hope it helps Jonathan
    370 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following