× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Let me clarify what I am attempting to do.
I have a file with the key: Company, Location, Item, Seq#, Substitute Item.
The file has additional fields.
The user sees all substitute items for the Company, Location, Item and can change the Sequence # and other data shown.
Since the user can change the sequence #, I need to process all records for the group.
When I do the update/add, I need to resequence the data on file based on the seq# the user keyed.

This is similar to what is done in SEU when you insert or delete lines.

What I am doing now is storing the screen seq# & substitute item in an array, sorting the array and then deleting all records for the group.
When I output the records from the subfile, I assign a sequence # based on the location of the seq#/item in the array.

I was hoping for a less messy method to get the same result.

Thanks,

Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3









----- Original Message ----
From: Alan Shore <AlanShore@xxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Sent: Thursday, December 6, 2007 1:41:13 PM
Subject: Re: Resequence data in file based on screen seq

Hi Jeff
I suppose it depends on what your definition of simple is.
Anyway, the method I use is independent of version.

Load the database records into the subfile, where each subfile record has
the keys (original sequence #) as hidden fields.
The user then changes the data displayed (add/change/delete)
When the user decides to update the database (through a function key)
chain through the subfile from rrn 1 to not %found
Using the hidden fields as keys to the database record, chain the database
file
if the record is not %found, write the database record based upon the data
on the subfile record
if the record is %found
if the sub file record shows that it is to be deleted (sequence # =
zero (or blank or whatever) delete the database record
otherwise
change the database record appropriately from the sub file record and
update

Hope this helps



Alan Shore

NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
"If you're going through Hell, keep going" - Winston Churchill

rpg400-l-bounces@xxxxxxxxxxxx wrote on 12/06/2007 01:29:10 PM:

Does anyone have a simple method to resequence data in a file based
on the new sequence # on a screen?
I am limited to V5R1 with any concepts used.

The file has a sequence # as part of the primary key.
The user will see a subfile of all records in the file with the
sequence # available to be changed.
In addition, they can add records and specify any sequence # they choose.
Add, Change and Delete are all done in one pass.

Thanks,

Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical
Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical
Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical
Solutions Implementer V5R3





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

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