sponsored links



No announcement yet.

Obtain value of specific column/row

  • Filter
  • Time
  • Show
Clear All
new posts

  • Obtain value of specific column/row

    Image Url: https://imgur.com/vNSNPXI

    Hey Everyone,

    Getting my feet wet this week with dspfs and rpgle! Hopefully there is a quick answer to this and I am not overthinking this. I am trying to get the data back from a specific column where the cursor is located. For example the cursor is on column "Confirmation Code/ Check #" and when I press enter I would like to pass this value to my rpgle program where it goes and grabs additional information on the specific confirmation code and then display it on the screen. I have created the rpgle program that pops up a new screen on top of the current one, but now I am actually trying to load some data into. Thoughts?

    I have seen a few things such as SFLCSRRRN but I haven't been able to make anything work. I'm not sure if I should load the subfile from the previous screen or what the best way would be.

    BONUS: To be able to put your cursor over the specific "Confirmation Code/Check #" and have it show the relative information without additional input from the user.


  • #2
    Check this out:
    On an input operation, the cursor location can be determined by looking at the I/O feedback area or specifying the appropriate parameter on the RTNCSRLOC keyword. See the Application Display Programming book for more information about the I/O feedback area.


    • #3
      So you have a subfile on the screen with one of the columns being Confirmation Code and you want the user to be able to put the cursor on one of the confirmation codes in the list and hit enter and get more information about that particular one, is that right? If so, then use the RTNCSRLOC keyword to retrieve the field name that the cursor is on and the SFLCSRRRN to retrieve the RRN of the subfile that the cursor is on, then chain to the subfile record using that RRN to retrieve the value of the confirmation code.

      A                                      RTNCSRLOC(&CURRCD &CURFLD)
      A                                      SFLCSRRRN(&CURRRN)
      A            CURRCD        10   H      TEXT('Cursor position - record')
      A            CURFLD        10   H      TEXT('Cursor position - field')
      A            CURRRN         5  0H      TEXT('Cursor position - subfil rrn')
      C                   If        curfld = 'CONFCODE'     or whatever the name of the confirmation code field is
      C     currrn        Chain     subfile
      C                   Callp     windowprogram(confcode)
      C                   Endif