DDS / RPG – cursor management

My question is regarding cursor management. My application displays list of members (using RPG and DSPF). There is one input field per row, in which the user enteres the option he wishes to preform on the selected row. The RPG processes the selected row, by the given option. My question is: When the RPG completes its process on the selected row - I re-display the screen. How can I place the cursor exactly on the input field in the row which the user selected before he hit 'ENTER'. In other words, The user want to perform option number 2, and then option number 3 on the same row. I want him the have the cursor on the same row he started to work with when option 2 completes. Currently, my cursor is placed on the input field of the FIRST row on the screen. I tried many suggestions. None helped. thanks

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can try this…hope it works!
1. Set a hidden field (flag) that you set on when option 2 is selected on that subfile record. Try using this flag to possition cursor the next time the subfile is displayed.


2. Re display the subfile positioning on the subfile record that was selected. When the subfile is re-displayed then the prior selected record will be the first record.


Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TomLiotta
    You didn't tell us what you tried; only that what you tried didn't work. That means we have to guess if you already tried what we might suggest. How do you remove the option that the user entered from the option field? Bo you rewrite the subfile? Or do you issue an UPDATE to the subfile RRN to blank out just that one subfile option field? Tom
    125,585 pointsBadges:
  • pdraebel
    Updating the subfile record with display attribute Position cursor in effect. If you have updated multiple records with this indicator active the cursor will be positioned on the first subfile record that has the display attribute in effect.
    7,545 pointsBadges:
  • Splat
    For your problem, this'll work if the records displayed don't change (1st stays 1st, 2nd stays 2nd) from when the Enter key is pressed to when the records are redisplayed. On the SFLCTL record format, include this:
                              CSRLOC(ROW        COLUMN)
                              RTNCSRLOC(&FORMAT &FIELD)
    ROW            3S 0H                               
    COLUMN         3S 0H
    In the RPG include this:
    FDisplay   Cf   e             Workstn                     
    F                                     sfile(subfile: rrna)
    F                                     infds(workstn)      
    D Workstn         Ds                 
    D  dspfilnm         *file            
    D  dsprcdnm         *record          
    D  function             369    369   
    D  cursor               370    371b 0
    Csr   cursor        Div       256           row   
    Csr                 Mvr                     column
    (I'm pulling this from an older program - don't bust my chops for not using /Free). If you want the cursor to assume the default position (first input-capable field on the format), simply clear row and column. This isn't limited to subfiles & has the advantage of not requiring any indicators.
    12,925 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: