|
|
All AS/400 Tip Categories
/
AS/400 Programming
/
Help with Subfile Programming in RPG III
Question:
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!
Books on this subject:
Subfile Programming Essentials
Answer(s):
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).
Other tips in this category:
Click here to see all categories.
Socket Programming And Timeout Issues
Deleting Duplicate Records From A Table
What are data queues and how to use
Retrieving SMTP Name
RPGLE example for Dynamic Screen Manager API
Calling APIs from CL - with examples!
Compare two strings in RPG character by character
How to search all pgms in QCLSRC for a keyword
Retrieve Database File Description (QDBRTVFD) API
How to redirect the output to STDERR from RPG-IV
Using Multiformat Logical To Join 2 Identical File
D-Spec *LIKE DEFN
RPG: Converting Character to Decimal
Example of ILE RPG CGI Program
Handling ILE RPG Numeric Overflow
Help with Subfile Programming in RPG III
Zoned parameter in ILE RPG
What's the best way to do modulus in CL?
RPG Nesting Source Print Utility
More on changing the SIGNON screen
A silly ILE RPG question
Calling Validation List API From ILE RPG
Soft Coding Module Names
RPG Multidimensional Arrays in Action
Build a Page-Equals-Size Lookup Window
Procedures within an ILE RPG program
Break msg from RPG
Source Debugger for batch jobs
RPGLE debugging
Timing out display sessions in DDS
Building Dynamic Stored Procedures
Put Message in System Log
Dynamic RPGSQL
Randomize function for the AS/400
What's the fastest way to do a simple RPG lookup?
First time Data queue application in RPG
Print file overflow in ILE RPG
Mapping Fields To Arrays in ILE RPG
Named inidicators
STRQMQRY: comparision operator '=' isn't correct?!
DSPDTAARA to an outfile - possible?
PCL ESC codes in RPG
Sharing DB files between two AS/400s
Help: AS/400 subfiles
How do you change the signon screen?
Determining Even/Odd Values in queries
Get day of the week in RPG
Convert UPPERCASE to lowercase
RPG IV help using APIs
Help with data area API
Detecing IFS Files from RPG
SQL in a CL program
Calling AS/400 APIs from ILE RPG
CVTDAT command to convert an *MDY to a *LONGJUL
CPYSPLF Automation
Subfile Window background problem
Using IFS APIs w/ ILE RPG
Packed or unpacked fields?
QRYDFN to source and back
What does the "optimize" parm do?
Determining the calling program
Sockets in RPG?
Sorting a user space
OVRDBF and SECURE() keyword in an ILE environment
RPG record locking
RPG Differences: V2R3 to V3R2 upgrade
Getting the relative record number (RRN)
What is the longest parameter usable in RPG?
A C function that returns a string to an RPG pgm
Problems with ZADD *ZEROS
Can you highlight code in SEU?
Reusing deleted records - OK?
Is there an easy way to change edit codes?
Help - Windowed Subfiles
Logical Files and DDS
AS/400 'machine language' - MI Programming
Library lists and performance
How to use ERRSFL
Updating in CL
Record lock wait time
Message subfile problem
Physical File Joins
CL: Copying User Profiles
Commands and PARM
ILE RPG, RPG IV, vs. RPG/400
RPG and subfiles
Multiple subfiles
Field masking for passwords
SFLMODE keyword in an ILE program
Subfile size
Color coding records in a subfile
MSGLINE in windows
Controlling cursor movement on a display file
API returns error! Why?
Put an RPG Program on the Web
Variable length records in RPG
Differences Between RPG400, RPG IV, and ILE RPG
|