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


  • Subject: Ooops, how do I release static memory?
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Mon, 08 Jan 2001 16:41:50 -0800
  • Organization: Pacer International

I created my own module that I had to use static memory for, because
I re-enter it and get the next record (from a table, not a file).  It
worked fine, the first time.  But now it *always* returns the same
data no matter what parameters I send to it.  I *thought* the activation
group was *caller*, so I even logged off and back on and it still returned
the same data.

How do I modify this program to release the static variables?

I snipped out some external call prototypes as I didn't think they had anything
to do with this bug and to reduce posting size.

Regards,

Jim Langston

//COPY QMODSRC,SYSTEMPR                                     
                                                             
 *************************************************          
 *** RtvNetF - Retrieve Net File List for User ***          
 *************************************************          
                                                             
P RtvNetF         B                   Export                
                                                             
 *** Prototype for RtvNetF Function ***                     
D RtvNetF         PI            31A                         
D  UserID                        8A   Const                 
D  Address                       8A   Const                 
D  CallType                      1A   Const                 
                                                             
...
                                                              
D Data            DS                  Static                  
D   NetType                      1A   Inz( *Loval )           
D   NetFile                     10A   Inz( *Loval )           
D   NetLib                      10A   Inz( *Loval )           
D   NetNumber                   10U 0 Inz( 0 )                
D                               95A   Inz( *Loval )           
D   ReturnData            1     31A                           
                                                              
D Options         DS                  Static                  
D   Rule                         5U 0 Inz( 2 )                
D   Length                       5U 0 Inz( 25 )                              
D   Offset                       5U 0 Inz( 0 )                               
D   Occurence                    5U 0 Inz( 1 )                               
D   Count                        5U 0 Inz( 0 )                               
D                                4A                                          
                                                                             
D Lib             S               *   Static                                 
D Idx             S               *   Static                                 
                                                                             
 *** If CallType is 'F' retrieve the User's network file list ***            
C                   If        CallType = 'F' Or CallType = 'f'               
                                                                             
C                   CallP     RSLVSP2( Lib : X'0401' +                       
C                             'QUSRSYS                       ' + X'0000' )   
                                                                             
C                   CallP     RSLVSP4( Idx : X'0ED1' + UserId + Address +    
C                             '              ' + X'0000' : Lib )             
                                                                             
C                   EndIf                                                    
                                                                             
 *** If we are not 'C'losing, retrieve the next record ***                      
      
C                   If        NOT (CallType = 'C' Or CallType = 'c')            
      
C                   CallP     FNDINXEN( %Addr( Data ) : Idx :                   
      
C                                       %Addr( Options ) : %Addr( Data ))       
      
                                                                                
      
C                   EndIf                                                       
      
                                                                                
       
 *** If we are 'C'losing, or have hit the end of the list, close the program 
***      
C                   If        CallType = 'C' Or CallType = 'c' Or               
      
C                             Count = 0                                         
      
C                   Eval      ReturnData = *Blanks                              
      
C                   Eval      *INLR = *on                                       
      
C                   EndIf                                                       
      
                                                                                
       
C                   Return    ReturnData                                        
      
                                                                                
       
P RtvNetF         E
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.