Solved

keep option value in single page subfile

Posted on 2004-04-26
7
705 Views
Last Modified: 2008-03-10
Hello friends ,
I have done single page subfile program.
I have an option field where user can enter options for update(2) & delete(4) . I want to know how to keep those option values even after pagedown or pageup . i.e if i type 2 in second record line and if i do pagedown and then pageup the value should be there .
What is the best way to handle this ???
Thanks n waiting
0
Comment
Question by:raj28
  • 4
  • 3
7 Comments
 
LVL 14

Expert Comment

by:daveslater
ID: 10926218
Hi
there are 2 ways, 1 is an array and the second is a Multi occuance data structure. You simply keey an index of where you are in the subfile and populate as necessary.

dave
0
 

Author Comment

by:raj28
ID: 10926235
Hi daveslater,
Can u pls give some code ...(also tell which is the best in performance and in simpliicity also )
Thanks n waiting
0
 
LVL 14

Expert Comment

by:daveslater
ID: 10926256
Hi
I would personally use and array (easier to code)  performance will not be an issue
is it RPG or RPGLE

Dave
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:raj28
ID: 10926269
hi.
rpgle
thanks n  waiting
0
 
LVL 14

Accepted Solution

by:
daveslater earned 250 total points
ID: 10926355
Hi the basic code would be

h                                                                      
 **************************************************************        
 ** Array to hold options                                              
DAryOption        S              1    Dim(32766)                      
DIdx              S              5  0                                  
 **************************************************************        
C     srRollf       Begsr                                              
 ** Initialsie subfile                                                
C                   Clear                   *in31                      
C                   WRITE     sflctl                                  
C                   Eval      *in31=*On                                
c                   Clear                   sflRRn                    
 **                                                                    
C                   Do        *Hival                                  
C                   Read      MyFile                                  
C                   if        %eof                                    
C                   Leave                                              
C                   endif                                              
 **                                                                    
C                   Eval      sflrrn=sflrrn + 1                      
 ** Set pervious option                
C                   Eval      idx=idx + 1                            
C                   eval      sflOpt=AryOption(Idx)                  
C                   Write     Sfl                                    
C                   ENDDO                                            
C                   ENDSR                                            
 **************************************************************      
C     srRollB       Begsr                                            
 ** Initialsie subfile                                              
C                   Clear                   *in31                    
C                   WRITE     sflctl                                
C                   Eval      *in31=*On                              
c                   Clear                   sflRRn                  
 **                                                                  
C                   Do        *Hival                                
C                   ReadP     MyFile                                
C                   if        %eof                                  
C                   Leave                                            
C                   endif                                            
 **                                                                  
C                   Eval      sflrrn=sflrrn + 1
 ** Set pervious option                
C                   Eval      idx=idx - 1                      
C                   eval      sflOpt=AryOption(Idx)            
C                   Write     Sfl                              
C                   ENDDO                                      
C                   ENDSR                                      

Dave
0
 

Author Comment

by:raj28
ID: 10926616
hi dave,
how the option values are storing in array ?
0
 
LVL 14

Expert Comment

by:daveslater
ID: 10926671
Hi
somthing like
**************************************************************          
C     srSetArray    Begsr                                              
 ** Store values                                                        
C                   If        Idx > 1                                  
C                   EVAL      Idx=(Idx-sflrrn)-1                        
C                   FOR       RRN1=1 TO SFLRRN                          
C     RRN1          CHAIN     SFL                                      
c                   eval      idx = idx + 1                            
C                   EVAL      AryOption(idx)=SflOpt                    
C                   ENDFOR                                              
C                   ENDIF                                              
 **                                                                    
C                   ENDSR                                              

This would be called at the start of each roll subroutine
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now