Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help on Subfile coding in RPGIII

169 views
Skip to first unread message

Candi So

unread,
Jul 16, 1999, 3:00:00 AM7/16/99
to
I am doing a subfile coding in RPGIII, and I would need some help on it.

Here is the scenario:
The subfile is a display only subfile, and therefore no subfile option is
needed. As the no. of records is not that much, all records will be loaded
to the subfile in the beginning, let say, SFLSIZ is 150 and SFLPAG is 14.
There're certain function keys available, of which, there's a SHIFT-LEFT
and a SHIFT-RIGHT key, which allows the user to shift the screen so as to
view all columns.

I am stuck with the problems:
(1) the relative record key; I defined a variable, D1RRN in the File
Specification, and incremented it by one while I was loading the records to
the subfile; I reset D1RRN to 1 when the subfile is first displayed, but I
found it didn't incremented or decremented correctly while paging up and
down. Besides, is it right that the paging is handled by the subfile
feature? 'cos I found it didn't loop through the Page Up and Page Down
routine in my program, unless top of page or bottom of page is hit.
(2) I used an indicator to control whether the left half or the right half
of the screen is being displayed; the indicator commands a DSPATR(ND) for
the corresponding fields. When the SHIFT-LEFT or -RIGHT key is hit, the
indicator is turned on or off correspondingly, and then the subfile is
displayed again. I didn't get the correct response. Is it right that I
should UPDATE the subfile again before I display it? I read some examples
that use READC to identify changed records and UPDAT those before writing
the subfile; however, per my case, there wouldn't be any change to any
record, how can I update every records on the current page?

I appreciate anyone who provides me some help on this issue!

CS

Paul Nicolay

unread,
Jul 16, 1999, 3:00:00 AM7/16/99
to
Hi Candi,

You found the answer yourself... once a subfile is loaded, it never gives
control back to the program for paging (unless PAG=SIZ). You do however get
control back when you press the function key, but since the subfile isn't
been rebuild it won't be of any use.

A solution... keep the subfile static (since you say it's small enough), but
make the following changes;

1. Define a big hidden field on te subfile record to contain a full line.
2. Define a single output field with the size of your screen
3. Either seton the SFLNXTCHG when writing the subfile, or
use the CHAIN/UPDATE (yes, it works) method to update every record in
the subfile
4. Substring out of the big hidden field, the part that you want to show

The hidden field can also be replaced by an array if you wish, but I
consider the hidden field easier. Regarding the ND approach, I remember
from long time ago that it doesn't work on subfiles (but I'm not sure).

Kind regards,
Paul
----------------------
Candi So wrote in message <01becf55$3d272d20$8f8d...@cso.pathcom.com>...

CS


The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.

Jay

unread,
Jul 18, 1999, 3:00:00 AM7/18/99
to
The easiest way to handle this is to do it page-by-page.
Define the SFLSIZ one bigger than the SFLPAG. When the user presses the roll
down, the next page is loaded. When page up is pressed, the machine takes care
of the roll-backwards.

If you want to see a template that does this, email me direct...

Joep Beckeringh

unread,
Jul 19, 1999, 3:00:00 AM7/19/99
to
Candi,

Another option would be to define two (or more) subfiles; one for each set
of columns you want to display. But whichever technique you use, you'll
probably want to show the same page of the subfile when you redisplay. For
that you need a (preferably hidden) field in the subfile control record to
determine which subfile record should be shown (look at SFLTOP in the DDS
reference). In the INFDS for the display file in the RPG there is a field
that contains the record number of the first subfile record on screen; if
you put this record number in the SFLTOP field, the same page will be shown
again.

Joep Beckeringh

Paul Nicolay

unread,
Jul 19, 1999, 3:00:00 AM7/19/99
to
Jay,

Your method won't work, as scrolling back will not allow you to
shift-left-right. The only way is to rebuild the subfile (see my posting
for the various methods).

Regards,
Paul
------------------
Jay wrote in message <37925D75...@ce.net>...


The easiest way to handle this is to do it page-by-page.
Define the SFLSIZ one bigger than the SFLPAG. When the user presses the roll
down, the next page is loaded. When page up is pressed, the machine takes
care
of the roll-backwards.

If you want to see a template that does this, email me direct...

The contents of this message express only the sender's opinion.

J Bailey

unread,
Jul 19, 1999, 3:00:00 AM7/19/99
to
Candi
Just use 2 subfiles & subfile headers & switch from 1 to the other.
Use the current top of subfile from the INFDS to use in the SFLRCDNBR
Jon.

Candi So

unread,
Jul 22, 1999, 3:00:00 AM7/22/99
to Paul Nicolay
Hi Paul,

Thanks for your suggestions! I've picked your suggestion of defining a big
hidden field, and rewrite the subfile when the switch key is pressed; it works
great. To ensure the same page is shown, I declared a hidden field for the
keyword, SFLSCROLL in the display file, which keeps track of the relative record
key for the top record on the page.
Yes, the DISPLAY(ND) approach won't work- I've tried it thoroughly and know it's
the field overriding problem that won't allow it.

Also thank to anyone who supplied solutions to this problem I had!

Thanks,
Candi

Paul Nicolay wrote:

> Hi Candi,
>
> You found the answer yourself... once a subfile is loaded, it never gives
> control back to the program for paging (unless PAG=SIZ). You do however get
> control back when you press the function key, but since the subfile isn't
> been rebuild it won't be of any use.
>
> A solution... keep the subfile static (since you say it's small enough), but
> make the following changes;
>
> 1. Define a big hidden field on te subfile record to contain a full line.
> 2. Define a single output field with the size of your screen
> 3. Either seton the SFLNXTCHG when writing the subfile, or
> use the CHAIN/UPDATE (yes, it works) method to update every record in
> the subfile
> 4. Substring out of the big hidden field, the part that you want to show
>
> The hidden field can also be replaced by an array if you wish, but I
> consider the hidden field easier. Regarding the ND approach, I remember
> from long time ago that it doesn't work on subfiles (but I'm not sure).
>
> Kind regards,
> Paul
> ----------------------
> Candi So wrote in message <01becf55$3d272d20$8f8d...@cso.pathcom.com>...

0 new messages