Solved

keep option value in single page subfile

Posted on 2004-04-26
7
713 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
Note: This is the third blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   We’ve been talki…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

867 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

25 Experts available now in Live!

Get 1:1 Help Now