title: Get subfile record number for non-active subfile(s)
body: <p>I have a program that displays 4 subfiles similarly to this:</p>
  
  <pre><code>        COL1     COL2     COL3
  SFLAA----------------------------|
      1    9999     9999     9999
      2    9999     9999     9999
      3    9999     9999     9999
                            *More...
  SFLBB----------------------------|
      1    9999     9999     9999
      2    9999     9999     9999
      3    9999     9999     9999
                            *More...
  SFLCC----------------------------|
      1    9999     9999     9999
      2    9999     9999     9999
      3    9999     9999     9999
                            *More...
  SFLDD----------------------------|
      1    9999     9999     9999
      2    9999     9999     9999
      3    9999     9999     9999
                            *More...
  </code></pre>
  
  <p>These subfiles show various types of summary information and users want to be able to click on any of these summary numbers and "drill down" to the underlying details. In order to do that I have to know which record in which subfile they clicked on.</p>
  
  <p>I'm retrieving the cursor location from the <code>INFDS</code> so when a user clicks on the screen I know which subfile they are clicking in (because I know what row they clicked on).</p>
  
  <p>The <code>SFLCSRRRN</code> keyword works wonderfully for the <code>SFLAA</code> subfile because it's the "active" subfile (the program does an <code>EXFMT CTLAA</code>, all other control formats are displayed via <code>WRITE</code>). So far I have not been able to figure out how to determine which record of a subfile has been clicked on if it's <code>SFLBB</code>, <code>SFLCC</code> or <code>SFLDD</code>.</p>
  
  <p>Each subfile holds up to ~100 records (all loaded at once) so it's possible (and likely) the user has scrolled the subfiles before clicking on them.</p>
  
  <p><strong>How do I determine which subfile record the user clicked on if they click on one of the "non-active" subfiles?</strong></p>
  
  <p>---- BEGIN EDIT ----</p>
  
  <p>I can get the Row/Col of where the user clicked on the screen just fine, my problem is when the user scrolls SFLBB, SFLCC or SFLDD down to say the 75th subfile record and then they click on that subfile. I can tell they clicked on row 8 on the screen (this would be the first line of SFLBB) - but I can't tell that's record 75 in SFLBB.</p>
  
  <p>---- END EDIT ----</p>
  
  <p>I've tried <code>SFLCSRRRN</code>, <code>SFLRCDNBR</code>, and <code>SFLSCROLL</code> in various combinations and just cannot get anything to work for the non-active subfiles.</p>
  
  <p>Here's relevant code from the <code>DSPF</code>:</p>
  
  <pre><code>A                                                    DSPSIZ(24 80 *DS3)
  A                                                    MOUBTN(*ULP CF06)
  A                        R SFLAA                     SFL
  A                          RRN1           4Y 0O  4 11EDTCDE(Z)
  A                        R CTLAA                     SFLCTL(SFLAA)
  A                                                    SFLSIZ(9999)
  A                                                    SFLPAG(0003)
  A                                                    CF03
  A                                                    OVERLAY
  A                                                    SFLCSRRRN(&amp;ARRN)
  A  10                                                SFLDSP
  A                                                    SFLDSPCTL
  A N10                                                SFLCLR
  A  11                                                SFLEND(*MORE)
  A                          ARRN           5S 0H
  A                                                3  2'SFLAA'
  A                        R SFLBB                     SFL
  A                          RRN2           4Y 0O  9 11EDTCDE(Z)
  A                        R CTLBB                     SFLCTL(SFLBB)
  A                                                    SFLSIZ(9999)
  A                                                    SFLPAG(0003)
  A                                                    OVERLAY
  A* Doesn't work                                      SFLCSRRRN(&amp;BRRN)
  A  15                                                SFLDSP
  A                                                    SFLDSPCTL
  A N15                                                SFLCLR
  A  16                                                SFLEND(*MORE)
  A* Doesn't work            BRRN           5S 0H
  A* Doesn't work            BRRN2          5S 0H      SFLSCROLL
  A                                                8  2'SFLBB'
  </code></pre>
  
  <p>Subfiles and control records <code>SFLCC/CTLCC</code> and <code>SFLDD/CTLDD</code> are logically identical to <code>SFLBB/CTLBB</code> so I have omitted them.</p>
  
  <p>Relevant RPGLE code:</p>
  
  <pre><code>ftestd              cf   e             workstn sfile(sflaa: rrn1)
  f                                              sfile(sflbb: rrn2)
  f                                              sfile(sflcc: rrn3)
  f                                              sfile(sfldd: rrn4)
  f                                              infds(cusloc)
  ...
  dcusloc                    ds
  d  rowcol                        370    371b 0
  ...
  drrn1                      s              4  0 inz(0)
  drrn2                      s              4  0 inz(0)
  drrn3                      s              4  0 inz(0)
  drrn4                      s              4  0 inz(0)
  ...
  c/free
  ...
    begsr mouse_sr;
       row# = rowcol / 256;
       col# = %rem(rowcol: 256);
       select;
          when row# &gt;= 4 and row# &lt;= 6;
             chain arrn sflaa;
             if %found();
                exsr detail1_sr;
             endif;
          when row# &gt;= 9 and row# &lt;= 11;
             chain brrn sflbb;
             if %found();
                exsr detail2_sr;
             endif;
          when row# &gt;= 14 and row# &lt;= 16;
             chain crrn sflcc;
             if %found();
                exsr detail3_sr;
             endif;
          when row# &gt;= 19 and row# &lt;= 21;
             chain drrn sfldd;
             if %found();
                exsr detail4_sr;
             endif;
       endsl;
    endsr;
  ...
  c/end-free
  </code></pre>