× 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.



Thanks Booth, but my problem is not sorting an array (even if I understand what you meant here); my problem is re-loading the subfile from an identical DS (actually an array of DS's; the number of array elements (DS's) is equal with the number of initial subfile records).



Thank you


Florin Todor





-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Booth Martin
Sent: Monday, September 27, 2010 4:05 PM
To: RPG programming on the IBM i / System i
Subject: Re: MODS Likerec

Here is how I did this in a learning program:

D ds
D Array 40 dim(50)
D Col1 10 overlay(Array)
D Col2 10 overlay(Array: *next)
D Col3 10 overlay(Array: *next)
D Col4 10 overlay(Array: *next)

sorta Col2;

Load the new rows that you wish to add at the end of the array, then
when you are ready to reload the subfile sort the array by what ever
field you wish to sort by. Then there is no issue with inserting new
records at the right moment. The nice thing about this solution is that
you can set up the sorting on whatever column you like; you are not
locked into the loading sequence.

There's more lil tricks if you want to sort by column heading, or if you
want to sort descending as well as ascending, but that would belabor
this point.



On 9/27/2010 1:10 PM, Florin Todor - YYZ Concord wrote:

Tried that, Stu, it doesn't work; the compiler coughs:

"*RNF7701 20 1 The data structure is not allowed for the operation."




Thank you


Florin Todor



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Stuart Rowe
Sent: Monday, September 27, 2010 1:13 PM
To: RPG programming on the IBM i / System i
Subject: Re: MODS Likerec

Dang, just re-looked at your source.

When you read the subfile, you are reading it directly to the mods structure
(see Chain).

When you write it, you ought to do the same thing, as in:

write R010D02 ds_det;

Stu


On Mon, Sep 27, 2010 at 12:09, Stuart Rowe<rowestu@xxxxxxxxx> wrote:


The issue arises from using likerec(). That keyword always qualifies all
subfield names, that's why it's not "automagical". Screen field FIELD1 is
not the same as ds_det.FIELD1.

I'd think the easiest for you to do is hand-code a DS with the screen field
names (do NOT use likerec for this), then repeatedly move the "input" data
structure (whatever you end up using, mods or array data structure) to the
structure with the screen fields in it.

screenStructure = ds_det;

or

screenStructure = ds_det( index );

Or something like that. Perhaps someone has a slicker method, but this'll
work. I can't remember if you could "prefix" the screen field names with
"ds_det." and make them match. Not near a compiler.


Stu





On Mon, Sep 27, 2010 at 11:27, Florin Todor - YYZ Concord<
ftodor@xxxxxxxxxxxxxxxx> wrote:

Birgitta, I can do that but does this solve my problem? Because, at first
sight, the only difference is I will use an array index instead of %occur
BIF to retrieve the DS values; under the covers, is it not the same idea
like MODS?


Thank you


Florin Todor



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Birgitta Hauser
Sent: Monday, September 27, 2010 12:13 PM
To: 'RPG programming on the IBM i / System i'
Subject: AW: MODS Likerec

Why do you want to use a MODS, why not defining an Array Data Structure?

D MYDS DS Dim(12345)
D MyRec LikeRec(MyRecord)

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"


-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Im
Auftrag von Tom Huff
Gesendet: Monday, 27. September 2010 18:02
An: 'RPG programming on the IBM i / System i'
Betreff: RE: MODS Likerec

Try creating another subfile and read from one and write to another and
then
back to the original with the records inserted on one of the passes.

Tom

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx
]
On Behalf Of Florin Todor - YYZ Concord
Sent: Monday, September 27, 2010 10:26 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: MODS Likerec

Hello everyone,



Before posting this question I hesitated a lot, because I know it is
something basic for most of you; unfortunatelly I couldn't find the
answer myself, so please help!



This is the idea: I have a subfile populated by the user. I want to
insert some records between already existed records if some criteria is
met. My idea was to read the entire subfile and to save it to a MODS
defined with LIKEREC(the subfile record name), clear the subfile and
repopulated it one by one record (reading MODS) and inserting, when
needed, the new subfile records.



My problem is I cannot retrieve the MODS. I do an %OCCUR(mods-name) = 1
and a WRITE the subfile record. In this moment, I thought the subfile is
automagically populated because they have the same field names... but
it's not!





Thank you





Florin Todor



<mailto:ftodor@xxxxxxxxxxxxxxxx>



--
This is the RPG programming on the IBM i / System i (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 IBM i / System i (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 IBM i / System i (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 IBM i / System i (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.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.