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



I have a template made for subfiles that I've used in the past.  It may 
not be to everyone's taste, but it might help.  It's attached.

     ?*-Define data 
structures--------------------------------------------------------
     ?* Error indicators for display file
     d DspInds         ds
     d   SflDsp                        n   Overlay(DspInds : 40)
     d   SflClr                        n   Overlay(DspInds : 41)
     d   SflEnd                        n   Overlay(DspInds : 42)
     ?
*-------------------------------------------------------------------------------
     ?* Clear subfile
     c                   Exsr      Clear_Sub
     ?* Load subfile
     c                   Exsr      Load_Sub
     ?* Loop until user presses F2
     c                   DoU       *Inkb
     ?* Write footer
     c                   Write     Footer
     ?* Display subfile
     c                   Eval      SflDsp = *On
     c                   Eval      SflEnd = *On
     c                   Exfmt     Header
     c                   Eval      SflDsp = *Off
     c                   Eval      SflEnd = *Off
     c                   EndDo
     c                   Eval      *InLr = *On
     ?*----------------------------------------------------------
     ?* Clear_Sub - Clear subfile
     ?*----------------------------------------------------------
     c     Clear_Sub     BegSr
     ?* Reset rrn, clear subfile
     c                   Eval      Rrn = 0
     c                   Eval      Rcd# = 1
     c                   Eval      SflClr = *On
     c                   Write     Header
     c                   Eval      SflClr = *Off
     c                   EndSr
     ?*----------------------------------------------------------
     ?* Load_Sub - Load subfile
     ?*----------------------------------------------------------
     c     Load_Sub      BegSr
     ?* Setup whatever loop for loading the subfile
     c                   Read      File
     c                   DoW       Not(%EOF(File))
     ?* Check to see that this matches the street name selected
     ?* Load field values
     c                   Eval      Sfopt = *Blanks
     c                   Eval      Sfdsc = Some_Field
     ?* Increase RRN
     c                   Eval      Rrn += 1
     ?* Write subfile
     c                   Write     Subfile
     c                   Read      File
     c                   EndDo
     ?* If none found
     c                   If        Rrn = 0
     c                   Eval      Sfopt = *Blanks
     c                   Eval      Sfdsc = 'No Files Exist'
     c                   Eval      Rrn += 1
     c                   Write     Subfile
     c                   EndIf
     c                   Endsr 

Ron Power
Programmer
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
Tel: 709-576-8132
Email: rpower@xxxxxxxxxx
Website: http://www.stjohns.ca/
___________________________________________________________________________
Success is going from failure to failure without a loss of enthusiasm. - 
Sir Winston Churchill




Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
2005/06/29 01:50 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Re: [Fwd: A question about subfile operations]






Hello Pete,

> I have been programming in RPG for about 20 years (started with RPG II 
in 
> 1985).  After all the discussion about Uber-programmers and what a 
"real" 
> programmer is, I am little reluctant to admit that I am not "classically 

> trained" programmer, I have learned "seat of the pants".

Me, too.

But, even if you had received a degree in RPG programming in 1985 (when 
you say you started) you probably would not have learned the techniques 
that we've been discussing here.

Learning programming is a contining thing. You don't just go to school 
once and then "know everything". You have to keep learning a little bit 
every month, since computers change a little bit every month.

> The problem I am encountering is that when you page down past the end of 

> the subfile records, the program closes.  You never see the last page of 

> records.  I can't see any logic in the program that says to end, and the 

> one place where last record IS set on and the program returns is not hit 

> when I debug the program.
[SNIP]

The following code ends when you hit the last record of the PF. When you 
hit page down for the last page, you'll hit the end of the PF, so it makes 

perfect sense that your program would end before displaying the last page:

>   C                   READ      PFAS210                   58
>   C     *IN58         IFEQ      *ON
>   C                   MOVE      *ON           *INLR
>   C                   RETURN
>   C                   END


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.