title: AS400 RPGLE/free dynamic variables in operations
body: <p>I'm fairly certain after years of searching that this is not possible, but I'll ask anyway.   </p>
  
  <p>The question is whether it's possible to use a dynamic variable in an operation when you don't know the field name.  For example, I have a data structure that contains a few hundred fields.  The operator selects one of those fields and the program needs to know what data resides in the field from the data structure passed.  So we'll say that there are 100 fields, and field50 is what the operator chose to operate on.  The program would be passed in the field name (i.e. field50) in the FLDNAM variable.  The program would read something like this the normal way:</p>
  
  <pre><code>/free
    if field50 = 'XXX'
    // do something
    endif;
  /end-free
  </code></pre>
  
  <p>The problem is that I would have to code this 100 times for every operation.  For example:</p>
  
  <pre><code>/free
    if fldnam = 'field1';
    // do something
    elseif fldnam = 'field2';
    // do something
    ..
    elseif fldnam = 'field50';
    // do something
    endif;
  </code></pre>
  
  <p>Is there any possible way of performing an operation on a field not yet known?  (i.e. IF FLDNAM(pointer data) = 'XXX' then do something)</p>