Single Page Subfile code

120 pts.
AS/400 Subfiles
Hi i have started learning Subfile and i've written a Load All Subfile code to display all the records in a PF. Iit is working fine.But I want to know what else should i include in this code to make it accodring to coding standard. Also i need help in writing the single page Subfile program.So what things should i include in this code to make it work as Single Page Subfile. Here is the code 

FVb001sflpfIF E k Disk FVb001sfl CF E Workstn SFILE(VB1SFL:@RRN) D@Rrn S 3 0 ***----------------------------------------------------->> C Exsr SflCLr C Exsr SflDsplay C Eval *inlr = '1' ***-----------------For Sfl Clear ---------------------->> C SflCLr BegSr C Eval *in50= '0' C EndSr ***-----------------For Sfl Display--------------------->> C SflDsplay BegSr C ' ' SETLL Vb001sflpf C WRITE VB1CTL C WRITE VB1BTM C Eval *in50 = '1' C EVAL @RRN = 0 C Read Vb001sflpf C DOW Not%EOF(Vb001sflpf) C MOVE PFITEMID SFLITEMID C MOVE PFAMT SFLAMT C MOVE PFDESC SFLDESC C EVAL @RRN = @RRN + 1 C Write VB1SFL C Read Vb001sflpf C ENDDO C DOW *IN03 = '0' C Exfmt VB1CTL C ENDDO C EndSr 

Software/Hardware used:

Answer Wiki

Thanks. We'll let you know when a new response is added. this code is not standard according to me because if you are reading a file then it may be possible that it can contain records greater than 9999, which is the highest maximum records which we can load in subfile. so i think that logic is missing from this code and also some looping concepts, just you have to check that. You can also do better programming with *Inzsr subroutine.
If you are going to do single page subfile programming then you can follow this logic that…first you have read then load….then display….then clear then again read and so on..until you want whether till end of file or something till at increment level.

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Splat
    Coding standards vary from company to company.  Without knowing what those standards are it is not possible for anyone here to judge whether your code meets those standards or no.  For a 'Single Page Subfile' you will need to develop code that handles the loading of the specific subset of data you wish to present.  There are numerous examples accessible through a quick search of the internet.To borrow a phrase from TomLiotta, what is the specific technical problem you're having? 
    12,915 pointsBadges:
  • Splat
    Apparently this editor has an odd and inconsistent view of paragraphs.
    12,915 pointsBadges:
  • philpl1jb
    For the load all, I would have a seperate subroutine for loadSFL and dspsfl.   I would say the for about $4.00 used plus $50 handling and Shipping you should get the book Essentials of Subfile Programming and Advanced Topics in RPGIV.    If you think you have questions now..wait till you try to read the book!
    54,090 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: