|
Chris,
Take a look at GLNOWRK at netshare400. (63.167.147.10) use your telnet client
and log on as wyatterp.
See if it behaves the way you want. But this is the portion that handles
subfile positioning.
XGPSN$ - Position to request string
XGBGN$ - subfile key beginning value
XGLST$ - subfile key last value
XGTOP# - subfile page starting record number
XGBTM# - subfile bottom number (number of records in subfile)
XGSFL# - current subfile record number
XGPGSZ - subfile page size
@XGGET - performs XGSFL# CHAIN to subfile, returns Ind 90/N90
XGKEY - subfile record key value
Basically what the routine does is perform a halving to determine which page
the requested entry may be located on then loops through the entries on that
page looking for a match or higher key value.
Once that has been determined, field XGTOP# is set and used in the DDS to
position the subfile display. BTW, we do a DSPATR(PR ND)on the position to
fields if subfile size is LE page size so it's not handled in this routine.
Routine $CF17 (Top) just sets XGTOP# to 1, and $CF18 basically does a
XGTOP# = (XGBTM# - XGPGSZ) + 1.
It's not really RPGLE, it's just plain old RPG/400 run through the CVTSRC.
0035.00 C* -----------------------------------------------------------------*@
0036.00 C @XGPSN BEGSR
0037.00 C*
0038.00 C XGPSN$ CASLE XGBGN$ $CF17 Top
0039.00 C XGPSN$ CASGE XGLST$ $CF18
Bottom
0040.00 C CAS @XGSET
Position to
0041.00 C END
0042.00 C*
0043.00 C ENDSR
0044.00 C* ------------------------------------------------------------------
0045.00 C @XGSET BEGSR
0046.00 C*
0047.00 C *LIKE DEFINE XGTOP# BHTOP#
0048.00 C *LIKE DEFINE XGBTM# BHBTM#
0049.00 C *LIKE DEFINE XGSFL# BHSPAN
0050.00 C Z-ADD *ZERO BHTOP#
0051.00 C* At this point the search argument must be within the subfile
0052.00 C* range of values, so perform binary halving to locate entry.
0053.00 C Z-ADD XGBTM# BHBTM#
0055.00 C BHBTM# DIV 2 BHSPAN
0056.00 C BHTOP# ADD BHSPAN XGSFL#
0057.00 C* Find the page which contains the record requested
0059.00 C BHSPAN DOWGE XGPGSZ
0060.00 C EXSR @XGGET
0061.00 C* IF you happen to hit right on, set the subfile cursor
0062.00 C XGPSN$ IFEQ XGKEY
0063.00 C Z-ADD XGSFL# XGTOP#
0064.00 C LEAVE
0065.00 C ENDIF
0066.00 C* ELSE Determine which way to look
0067.00 C XGPSN$ IFLT XGKEY
0068.00 C Z-ADD XGSFL# BHBTM#
0069.00 C ELSE
0070.00 C Z-ADD XGSFL# BHTOP#
0071.00 C ENDIF
0072.00 C* Slice the section in half again
0073.00 C BHBTM# SUB BHTOP# BHSPAN
0074.00 C BHSPAN DIV 2 BHSPAN
0075.00 C BHTOP# ADD BHSPAN XGSFL#
0076.00 C ENDDO
0077.00 C* Once the section is located, perform loop to find requested entry
0078.00 C XGPSN$ IFNE XGKEY
0079.00 C* Position file cursor
0080.00 C Z-ADD BHTOP# XGSFL#
0081.00 C EXSR @XGGET
0082.00 C* Loop through page
0083.00 C XGKEY DOWLT XGPSN$
0084.00 C ADD 1 XGSFL#
0085.00 C EXSR @XGGET
0086.00 C N90 ENDDO
0087.00 C 90 SUB 1 XGSFL#
0088.00 C*
0089.00 C Z-ADD XGSFL# XGTOP#
0090.00 C ENDIF
0091.00 C*
0092.00 C ENDSR
****************** End of data ****************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.