ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Getting the correct relative row number from multi-line subfile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting the correct relative row number from multi-line subfile

    I have a multi-line subfile that I am having problems getting the correct subfile row number of the cursor on a page past the first.

    Seems like I am missing a fundamental piece that should make it easy, but when the user rolls to page 2 of the subfile, arrows down to a specific line and presses a F key to delete the line, the subfile row number that is used in the chain to be able to read the file is wrong.

    I am looking for fresh ideas on how to do this, I think my code is...over-though.

    Here is some code...
    Code:
    A          R BOM200C4B                 SFLCTL(BOM200F4B)
         A*%%TS  SD  20101202  104228  KRIS        REL-V5R4M0  5722-WDS
         A                                      SFLSIZ(0018)
         A                                      SFLPAG(007)
         A                                      WINDOW(6 42 15 34)
         A                                      OVERLAY
         A                                      WDWBORDER((*COLOR GRN))
         A                                      WDWBORDER((*CHAR '/-\||\_/'))
         A                                      USRRSTDSP
         A  72                                  SFLEND(*PLUS)
         A  77                                  SFLDSP
         A N78                                  SFLDSPCTL
         A  75                                  SFLINZ
         A  78                                  SFLCLR
         A  73                                  SFLMSG('No records were found to sa-
         A                                      tisfy the search request.' 93)
         A  74                                  SFLMSG('Cursor was placed on a blan-
         A                                      k line.' 94)
         A  71                                  SFLMSG('Highlighted color change(s)-
         A                                       invalid' 71)
         A            SRCDB          4S 0H      SFLRCDNBR(CURSOR)
         A            SFLRNB         5S 0H
         A          R BOM200B4A
         A                                      OVERLAY
         A                                 23  1'Roll'
         A                                 23 20'F6:Toggle Cursor'
         A                                 23 40'F2: Accept BOM'
         A                                 23 73'F3:Exit'
         A                                 24  1'Enter'
         A                                 24 73'F12:Prev'
         A            S4F7TEXTFT    15A  O 24 20
         A            ISQTXT        15A  O 24 40
    Data Stucts for system cur row/col translation
    Code:
    D DATAIN          DS
         D  cfkey                369    369
         D  ROWIN                370    370
         D  COLIN                371    371
         D  SFLPG#               378    379B 0
         D  SFL#RC               380    381B 0
          *
         D                 DS
         D  ROW#                   1      2B 0
         D  ROW                    2      2
         D  COL#                   3      4B 0
         D  COL                    4      4
    free code for RRN
    Code:
    Row# = 0;
             ROW = ROWIN;
             Col# = 0;
             Col = Colin;
             IF ROW# < 7 OR ROW# > 20;
               *in94 = *on;
               SRCDB = SFLPG#;
             ELSE;
               GG = SFLPG# - 1;
               SFLRNB = Row# - 6;
               SFLRNB = SFLRNB + GG;
               IF %REM(SFLRNB:2) = 0;
                 // get the remainder of division to check for an even number
                 // even / 2 will always be 0.  Equiv to doing MOD division
                 SFLRNB = %div((SFLRNB):2);
               ELSE;
                 SFLRNB = 1 + (%div((SFLRNB - 1):2));
               ENDIF;
             ENDIF;
    It's seems really odd that I have to go through all that work to determine the (incorrectly) RRN. What am I missing to make this a lot easier?

    thanks again!

  • #2
    Re: Getting the correct relative row number from multi-line subfile

    can you try using:
    Code:
    A                                      SFLCSRRRN(&WHERE)
    RPG
    Code:
          *                                                          
         c                   if        where > *zeros                
         c     where         chain     SUB01                         
         c                   if        %found(CIT0008AD)             
         c                   eval      OutShipTo = S1SHIPTO          
         c                   eval      Endscreen1 = 'Y'              
         c                   endif                                   
         c                   endif
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Getting the correct relative row number from multi-line subfile

      Absolutely great! Thanks Jamie!

      Comment

      Working...
      X