|
If seq# is not part of the unique key, you could do something likelist
below
(Note: Syntax might be wrong.)
For sfRRN = 1 to ??
Chain sfRRN mySubFile;
if %found;
Chain (orgKey1 :orgKey2...) myFile;
if %found;
Seq# = sfRRN * 10;
update myFile;
endif;
endif;
Endfor;
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Friday, December 07, 2007 9:05 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Resequence data in file based on screen seq
The reason I do not just update is that after the user enters all
their data, when writting back to the file, I need to sequence the
data in increments of 10 so that they can move things around without
having to change all records.
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: Joep Beckeringh <joep@xxxxxxxxxxxxxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Sent: Friday, December 7, 2007 9:02:22 AM
Subject: Re: Resequence data in file based on screen seq
Jeff,
Why do you delete all the records of the group? Why don't you just
update?
What I do in situations like is to store the original sequence # as a
hidden field in the subfile. With the original and new sequence # you
can determine what to do:
- original = 0 and new > 0: add
- original > 0 and new = 0: delete
- original <> new: update
The tricky bit is checking for duplicates. You need to check each
new/changed sequence # with the file and also check for duplicates
within the subfile.
Joep Beckeringh
Jeff Young schreef:
Let me clarify what I am attempting to do.Item.
I have a file with the key: Company, Location, Item, Seq#,
Substitute
The file has additional fields.can change the Sequence # and other data shown.
The user sees all substitute items for the Company, Location, Item
and
Since the user can change the sequence #, I need to process allrecords for the group.
When I do the update/add, I need to resequence the data on fileon the seq# the user keyed.
based
lines.
This is similar to what is done in SEU when you insert or delete
array, sorting the array and then deleting all records for the group.
What I am doing now is storing the screen seq# & substitute item in
an
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
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
______________________________________________________________________
__
____________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search.
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,--
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.