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



Not sure what you mean by 'I am on the second page of the subfile'. You can think of a subfile as a kind of array that has a maximum of 9999 elements. What you see on the screen is simply a viewport over the array. But when you read from it, you are reading from the whole thing. There are three ways to read from the subfile. Using read, readc, or chain. First is chain in a for loop. I prefer this method since I always know how many records I have in my subfile and I can use a for loop to read through my subfile like this:

dcl-s ix Int(5);
dcl-ds sflin likerec(sfl: *input) inz;
for ix = 1 to maxsfl;
chain ix sfl sflin;
...
endfor;

This does not put any superfluous records in the job log, and it also is far simpler to manage than readc and sflnxtchg. To determine if a record is changed, I simply keep hidden copies of every input field, and compare the saved value to the input field. Those hidden copies are loaded with the subfile record, and do not change until I save the subfile record out to the database.


The next example is using read inside a do loop:

dcl-ds sflin likerec(sfl: *input) inz;
read sfl sflin
dow not %eof();
...
read sfl sflin;
enddo;

Note, this will put a message in the job log every time you read past the end of your subfile. I prefer not to see this message, so I avoid this method of reading through a subfile in favor of the previous example. You could always do some message management to remove the "tried to read an invalid subfile record" messages from you job log, but that is just an extra step.


Readc is much like read, but it only reads changed subfile records, or ones that have been marked changed on write by the sflnxtchg keyword. I don't think this is worth the effort any more as bandwidth is significantly improved over the ASCII workstation with a 300 baud modem days.


If nothing here helps you, please be more specific with your question. Particularly what you are doing to get 'on the second page of the subfile'.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Hoteltravelfundotcom <hoteltravelfun@xxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
From: Hoteltravelfundotcom <hoteltravelfun@xxxxxxxxx>
Date: 04/21/2016 02:05PM
Subject: Re: Conceptual subfile question


OK I finally see WHAT it is. The second page, I have the order# value of
the first page the one I updated. So that's why it's not writing the new
value. Why this is, I have to check. IOW, why if I am on the second page of
the subfile
is the order# from back on page1.

On Thu, Apr 21, 2016 at 1:08 PM, Hoteltravelfundotcom <
hoteltravelfun@xxxxxxxxx> wrote:

I have added a field, to a screen which is not the subfile but is called
when you want to change that line.

I added one standalone field a yes-no 'Y' field to the screen.
I write this to a small file, with the order# passed and this 'Y'. When
they run the program and want to change on that screen or display, it will
show a 'Y' if that is in this small file.

When I add my 'Y' from the first page of the subfile, it write it fine.
More than one record from the first subfile page is fine, it writes as many
as needed.

But then when I go to the next subfile page, select a row and put in this
'Y' it will not write it.

However, if I start out, by scrolling to second subfile page, put the 'Y'.
that it will write.

This is a very large large program and am having trouble debugging.

What would u say is happening conceptually, that it works fine for only
one subfile page?



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.