ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Cursor positon reading blank value from DSPF

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

  • Cursor positon reading blank value from DSPF

    Hello All,

    I am tring to prompt on a field which returns some value but the RTNCSRLOC for Cursor field (CSRFLD) that has been defined in DSPF reads a blank value. Why does this happen.
    The logic has also been incorporated iinto the RPGLE program for CSRFLD for some "A".
    Please guide on the possible reasons that could be triggering this issue.

    Thanks

  • #2
    Re: Cursor positon reading blank value from DSPF

    Is it defined in the record format that you are prompting from?
    Please post some DDS.
    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: Cursor positon reading blank value from DSPF

      Hi Jamie,

      Yes it is defined in the record format of the DSPF.
      Snippet in DSPF:
      PHP Code:
      A          R INFO                                                                                                                     
      A                                      RTNCSRLOC
      (&CSRRCD &CSRFLD)       
      A                                      SLNO(01)                 
      A                                      CLRL(21)                 
      A                                      CSRLOC(CSRROW     CSRCOL)
      A            CSRRCD        10A  H
      A            CSRFLD        10A  H
      A            CSRCOL         3S 0H
      A            CSRROW         3S 0H 
      The DSPF contains no ctl or sfl just *record format definition

      In the rpg its defined as follows:
      PHP Code:
      FDSPTEST  CF   E             WORKSTN              
      F                                     INFDS
      (Infods)                                                 
      D Infods          DS                                    
      D Csrloc                370    371  0                   
      D  
      #Row                          1    OVERLAY(Csrloc)   
      D  #Col                          1    OVERLAY(Csrloc:2) 
      D Srrn                  378    379B 0                   
      D Sfltot                         4B 0                   
                                                              
      D Rowcolds        DS                                    
      D Row                            4B 0                   
      D  Crow                          1    OVERLAY
      (Row:2)    
      D Col                            4B 0                   
      D  Ccol                          1    OVERLAY
      (Col:2)    

      C                   when      Csrfld 'PERIOD'   
      C                   MOVE      *ON           *IN25 
      Here it doesnt read csrfld as period inspite of being there and when seen through debug it was blank value.

      Please help.

      Comment


      • #4
        Re: Cursor positon reading blank value from DSPF

        Where is your EXFMT?
        are you using CA04 of CF04 to prompt on the field?
        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


        • #5
          Re: Cursor positon reading blank value from DSPF

          Code:
          C                   exfmt     info            
           *                                              
          C                   EVAL      Csrrow = 0        
          C                   EVAL      Csrcol = 0        
          C                   EVAL      Row = 0           
          C                   MOVE      #Row          Crow
          C                   EVAL      Col = 0           
          C                   MOVE      #Col          Ccol
          CF04 has been used with an indicator

          Comment


          • #6
            Re: Cursor positon reading blank value from DSPF

            Try to change the definition of your file status structure as follows:
            Code:
            D  #Row                370    370I  0   
            D  #Col                371    371I  0
            The row and column information is returned in position 370/371 as binary value (you defined it as packed and overlayed it with a character field).
            When defining position 370 and 371 as Integer value, you shoud get the Row and column returned

            Birgitta

            Comment


            • #7
              Re: Cursor positon reading blank value from DSPF

              if you want the field name you need to use field.
              &CSRFLD
              This is defined in your DDS.

              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


              • #8
                Re: Cursor positon reading blank value from DSPF

                Hi,
                I made the changes as mentioned in rpg but still cursor doesnt work
                Code:
                D Infods          DS                                 
                D Csrloc                370    371  0                
                D  #Row                 370    370I 0   <-----             
                D  #Col                 371    371I 0     <-----           
                D Srrn                  378    379B 0                
                D Sfltot                         4B 0                
                                                                     
                D Rowcolds        DS                                 
                D Row                            4B 0                
                D  Crow                          1    OVERLAY(Row:2) 
                D Col                            4B 0                
                D  Ccol                          1    OVERLAY(Col:2)
                Please help.

                Comment


                • #9
                  Re: Cursor positon reading blank value from DSPF

                  This;

                  Code:
                  A                                      CSRLOC(CSRROW     CSRCOL)
                  Should have;
                  Code:
                  A                                      CSRLOC(CSRROW CSRFLD CSRCOL)
                  Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                  Comment


                  • #10
                    Re: Cursor positon reading blank value from DSPF

                    That modification gives me this error on edit

                    Too many values specified for keyword 'CSRLOC'.

                    Comment


                    • #11
                      Re: Cursor positon reading blank value from DSPF

                      this works:
                      DDS
                      PHP Code:
                      A                                      DSPSIZ(24 80 *DS3)                
                      A          R SCREEN1                                                     
                      A                                      CF04
                      (04)                          
                      A                                      CF03(03)                          
                      A                                      RTNCSRLOC(&#REC &#FLD)            
                      A                                  6  8'Field'                           
                      A                                  6 14'#1:'                             
                      A            S1FIELD1      10A  B  6 18                                  
                      A                                  7  8
                      'Field #2:'                       
                      A            S1FIELD2       4A  B  7 18                                  
                      A                                 22  9
                      'F3=Exit'                         
                      A                                      COLOR(BLU)                        
                      A                                 22 19'F4=Prompt'                       
                      A                                      COLOR(PNK)                        
                      A                                  7 23'*'                               
                      A                                      COLOR(PNK)                        
                      A                                  6 29'*'                               
                      A                                      COLOR(PNK)                        
                      A            #REC          10A  H                                        
                      A            #FLD          10A  H 
                      RPG:
                      PHP Code:
                      fDDS       cf   e             WORKSTN             
                       
                      *                                                
                       *  
                      Field Definitions.                            
                       *                                                
                      d DisplayScreen1...                               
                      d                 s               n   inz('1')    
                      d reply           s             10                
                                                                        
                       
                      /free                                            
                                                                        
                                                                        
                          reset DisplayScreen1
                      ;                         
                          
                      dow  DisplayScreen1;                          
                                                                        
                           
                      exfmt SCREEN1;                               
                           
                      select;                                      
                            
                      when *in03;                                 
                             
                      DisplayScreen1 = *off;      
                            
                      when *in04;                             
                             
                      dsply #fld reply;                      
                           
                      endsl;                                   
                                                                    
                          
                      enddo;                                    
                                                                    
                                                                    
                         *
                      Inlr = *On;                               
                                                                    
                       /
                      end-free 
                      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


                      • #12
                        Re: Cursor positon reading blank value from DSPF

                        Jamie i cant play around much with the code as its a production source. How can i go about and make amends in my existing logic. Too tired to go about comparing fields in the sample source.I am still comparing what can be done to amalgamate yours with mine

                        Comment


                        • #13
                          Re: Cursor positon reading blank value from DSPF

                          Referencing the &CSRFLD should already work as suggested by jamief. Are you sure that your cursor is positioned on any of the screen fields when you pressed the <enter>?

                          Comment

                          Working...
                          X