Given a character variable containing a variable name, retrieve the pointer to the named variable.
This program uses the API QleGetExp, which means the variable whose 
pointer is to be retrieved has to be IMPORT/EXPORT. I created a service program 
to export the variables VAR1 and VAR2, and then bound
that into a program using the API:
                                               
 %Str( varName@ : %Len(varName) ) = 'VAR1';    
 var@ = getExp( *Omit                          
              : *Omit                          
              : *Omit                          
              : varName@                       
              : *Omit                          
              : expType                        
              : %Addr(ErrDS)                   
              );                               
                                               
 
After the call to the API, the pointer variable var@ contains 
the address of VAR1.
The following link takes you to the source code, written in beautiful /free ILE/RPG. The source is
distributed under a creative commons license. 
 
