ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Cursor position

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

  • Cursor position

    Select '1' and press Enter.

    Op Empid
    ________(Sel)
    __ XXXXXXXXXXXXXXXXXXXXXXXX
    __ XXXXXXXXXXXXXXXXXXXXXXXX
    __ XXXXXXXXXXXXXXXXXXXX


    Here in above screen shot if i enter the empid as 10(in "Sel" field),the subfile shd display NEXT THREE empid's .
    And if i take Op=1 , it shd update empid.
    If other than '1' is given ,it shd display "INVALID option",, my problem is if i give invalid option for any record in page4,it is displaying err msg,but the cursor goes to top most record of the subfile.
    i need my cursor to position to the same record where i have taken Op.

    I have handled these using SFLCSRRRN and SFLRCDNBR,by the pseudo code found from websites, im not clear wit these.

    ???

    Thanks in adv.

  • #2
    Re: Cursor position

    Hi, Use the DSPATR keyword for with the OPT field


    A OPT 1A B 10 7
    A 30 DSPATR(PC)
    A 30 DSPATR(RI)

    When invalid option entered set on the indicator 30 and update the subfile.It is better to use the SFLNXTCHG keyword also so that the record can be read on a next change
    Last edited by sai400; May 9, 2008, 01:19 AM.
    To every equation there is a solution....
    Regards
    Sai.

    Comment


    • #3
      Re: Cursor position

      The way SFLCSRRRN works is as follows

      We define a hidden variable in the display file associated with SFLCSRRRN.
      Code:
           A                                        SFLCSRRRN(&RELRCD);
           A                                        RTNCSRLOC(&CSRRCD &CSRFLD);
           A            RELRCD         5S 0H
      Then we assing the record number on which the cursor has to be positioned to the varibale RELRCD in the program before displaying the screen
      Regards,
      KR

      Comment


      • #4
        Re: Cursor position

        Originally posted by sai400 View Post
        Hi, Use the DSPATR keyword for with the OPT field


        A OPT 1A B 10 7
        A 30 DSPATR(PC)
        A 30 DSPATR(RI)

        When invalid option entered set on the indicator 30 and update the subfile.It is better to use the SFLNXTCHG keyword also so that the record can be read on a next change
        My problem is not with updating..
        Its the position problem.
        I need my cursor to be on the same record , after i giv value other than '1' on Opt field.
        If i giv other than '1' ,the cursor is going to topmsot record.

        Comment


        • #5
          Re: Cursor position

          Yes even my answer is not to update the Empid field .If you use DSPATR keyword you should update the subfile by turning on the respective indicator to position the cursor at the desired record
          To every equation there is a solution....
          Regards
          Sai.

          Comment


          • #6
            Re: Cursor position

            i think we can also use

            RTNCSRLOC(*WINDOW &ROW &COL)
            CSRLOC(ROW COL)

            in DDS for subfile, it will place cursor where it was in previous display
            Last edited by amar; February 12, 2009, 04:07 AM.

            Comment


            • #7
              Re: Cursor position

              Susan, It would be better if u could put the source for us to dig more.

              Neo

              Comment


              • #8
                Re: Cursor position

                Originally posted by neo85 View Post
                Susan, It would be better if u could put the source for us to dig more.

                Neo
                yes i agree
                put all your code
                so we can analyze it

                Comment


                • #9
                  Re: Cursor position

                  One more question-
                  There is a subfile which displays all records in load all processing. Say on 2n page, I took opetion 2 and went to next screen. Now I have cancelled the operation and returned to first screen. It then displays full screen from the first record and not from the record where i navigated the screen.

                  How this scenario is handled in Subfiles???

                  Comment


                  • #10
                    Re: Cursor position

                    You can use SFLRCDNBR in your dds

                    A SFRRN 4S 0H SFLRCDNBR(CURSOR)

                    and move the current rrn value to sfrrn after doing readc.

                    Comment


                    • #11
                      Re: Cursor position

                      Thanks Amar. It has worked out. I have been lazy at the subfiles programming. Thanks for your help

                      Comment

                      Working...
                      X