Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pointers

Status
Not open for further replies.

PeteAmsterdam

Programmer
Jun 3, 2005
76
US
I was reading an RPG 400 book. they talked about pointers in the RPG program. I have never seen any code using this.
How is it used?
 
PeteAmsterdam,

Here is ONE thing you can do with them. A lot of the API's (mostly the C function ones) use pointers.

Code:
 * Named indicators                                       
                                                          
D                 DS                  Based( IndicatorP ) 
D Exit                    3      3N                       
D Refresh                 5      5N                       
D F06                     6      6N                       
D Update                 10     10N                       
D Cancel                 12     12N                       
D RollDown               26     26N                       
D RollUp                 27     27N                       
D Error                  30     30N                       
D OpenError              76     76N                       
D DspMessage             80     80N                       
D SflDsp                 81     81N                       
D SflDspCtl              82     82N                       
D SflClr                 83     83N                       
D LastRecord             89     89N                       
D SubfileEOF             90     90N                       
D RcdNotFound            99     99N                       
                                                          
D IndicatorP      S               *   Inz( %Addr( *In ) )

HTH,
MdnghtPgmr
 
Forgot to post the example! Anyway setting up your indicators in this manner then lets you write code without using indicators. Some are for this and some are against it. I choose to like it! ;-)

Code:
   // Always display the message subfile              
                                                      
   DspMessage = *ON;                                  
                                                      
   // Mainline code                                   
                                                      
   DoW NOT Exit;                                      
       Request = 'DISPLAY';                           
       ExSr MsgRoutine;                               
       Write MSGCTL;                                  
       ExFmt EFD020A;                                 
       If NOT Exit;                                   
          Chain DBKEYS EFLACHDC03;                    
          If NOT( %FOUND( EFLACHDC03 ) );             
             IndAndMsg = '00' + 'XAI0001';            
             Request = 'SNDMSG';                      
             ExSr MsgRoutine;                         
          Else;                                       
             DoW NOT Exit And NOT Cancel;             
                 Request = 'DISPLAY';                 
                 ExSr MsgRoutine;                     
                 Write MSGCTL;                        
                 ExFmt EFD020B;                       
                 If Cancel;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top