How To get The Cursor position on particular field?

185 pts.
Tags:
AS/400
Cursor operation
DSPF
RPG
RPGLE
My display File Contains three Fields as like

name= ........

 Roll =........

 Marks=.......

 But In that Case when Program Call, First Cursor Pos On name When Name Will Enter Roll No will Automaticalyy Disply. But I have To Modify Marks Field,,, So When I will Enter Name After That I want To cursor On Mark Field So how can i do this? (In Dislpay File Any Keyword for cursor plz mention in detail )

Answer Wiki

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

The display attribute DSPATR(PC) position cursor might be what you’re after
It would be placed as a keyword for the input field, on the same line as the input field

If you want to be able to turn it on/off put it on a line after the field with an indicator
45 DSPATR(PC)
when 45 is set on in your program the cursor will be shown in this field.
Phil

Discuss This Question: 13  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.
  • Splat
    Another option would be to use the following:
    A                                      CSRLOC(ROW        COLUMN)
    A                                      RTNCSRLOC(&FORMAT &FIELD)
    A            ROW            3S 0H                               
    A            COLUMN         3S 0H                               
    A            FORMAT        10A  H                               
    A            FIELD         10A  H
    You don't need to keep track of indicators.
    10,775 pointsBadges:
    report
  • Djonises

    @Splat. How to "send" the cursor to a field, without using indicator?(lets say you have like 50+ fields).

    With your given method you cant do that. RTNCSRLOC is only for retrieving the field position and not setting the field position. CSRLOC is for setting the position but still you need to know the screen (x,y) values (almost impossible in a movable window).

    30 pointsBadges:
    report
  • ToddN2000
    When it comes to having that many fields that require you keep track of the cursor position it may be worth looking at other alternatives. Write a web application that access the DB2 data or try and break down the processing into smaller sections. There are just some thing that cannot be done due to the limits or RPG/ILE.

    70,435 pointsBadges:
    report
  • GregManzo
    Actually, the RPG *language* isn't the problem. The limits are imposed by the ugly green-screen display and the 5250 data stream. But still, a web display avoids that.
    1,190 pointsBadges:
    report
  • ToddN2000
    Your right GregManzo, RPG and CL have come a long ways since I started coding in them back in 1980. It's the DDS and terminal emulators that has not kept up with today's needs. Limiting displays to certain screen sizes 24x80 or 27x132 is outdated. I don't think I know of anyone still using a dumb CRT type terminal.
    70,435 pointsBadges:
    report
  • Splat
    Djonises, take a look at the workstation INFDS, particularly the cursor location from 370 to 371 (binary). Executing row = %div(cursor: 256) and column = %rem(cursor: 256) gives you the exact location of the cursor on the screen.
    I should have included that in my earlier response.
10,775 pointsBadges:
report
  • Splat
    ToddN2000, I'd still kill for a 5250 model 11. Best keyboard ever.
    10,775 pointsBadges:
    report
  • Djonises
    I need to do the opposite. To send cursor to a field. More specificaly there are about 50+ fields on my screen. I don't like to use the PC keyword because I want to save indicators for other parts of the program. How to "tell" cursor to go to a field before xfmt?
    30 pointsBadges:
    report
  • ToddN2000
    As far as I remember the only way to move the cursor to a screen field is by using the position cursor as mentioned earlier. Unless your program is very large and using all available indicators, why are you looking to do it another way?
    70,435 pointsBadges:
    report
  • Djonises
    DDS/RPG capabilities might look/be old fashioned but on the other side those capabilities are so many. For this reason perhaps there is something which can be done and I neglect. That is why I'm searching for different ways to get things done. Briefly I managed to do what I was after by combining Indicators in a grid assumed way. So I've made cords on fields where instead Of (x,y) I used (*in5#,*in7#). I got like 100 combinations by using 20 indicators (10x10). My fields are aligned like an excel spreadsheet.
    30 pointsBadges:
    report
  • ToddN2000
    Djonises@; Multiple indicators is a good way to do this..Say you had an order entry screen. For positioning the customer you could use 2 or 3 indicators depending on how complicated you wanted to make it. Example make all customer fields *IN10 and then an additional one for each filed you need the position cursor, like *IN90 - *IN99.
    Then for Item information, You could use *IN20 for those fields and the same *IN90 - *IN99. For Shipping information use *IN30 for those fields and the same positioning indicators *IN90 - *IN99
    70,435 pointsBadges:
    report
  • Splat
    Djonises, in that case the CSRLOC keyword is your friend.
    10,775 pointsBadges:
    report
  • ToddN2000
    Djonises@: Another thing to consider, we don't always get to code the way we like. Most departments have have worked in have standards like naming of files, and programs. They have to meet formats we have in place to make it easy for others to work with. The same goes for coding, there are certain indicators we can use and some we cannot. If you have free reign then do it how ever you are comfortable but if you work in a department you need to consider the rest of your coworkers if they ever have to maintain your program. 
    70,435 pointsBadges:
    report
  • 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.

    Following

    Share this item with your network: