Solved

keep option value in single page subfile

Posted on 2004-04-26
7
729 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article discusses how to implement server side field validation and display customized error messages to the client.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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