ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Subfile selections FULL CODe

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

  • Subfile selections FULL CODe

    hey guys
    here u can find my disply file who contains the first screen where i enter a code and then a second screen showing this code in addition to a subfile who contains the employees related to this code entered

    Code:
    [B]A                                      DSPSIZ(24 80 *DS3)      
    A                                      INDARA                  
                                                                   
    A                                      CF03(03 'Exit')         
    A                                      CF06(06 'TEST') 
    A                                      CF04(04 'Prompt')       
    A                                      CF08(08 'Forward')      
    A                                      CF12(12 'Previous')     
                                                                   
    A          R HEADER                                            
    A                                      OVERLAY 
    A            ##DATE        11A  O  1 68                            
    A                                      COLOR(GRN)                  
    A            ##WSID        10A  O  2  2                            
    A                                      COLOR(BLU)                  
    A            ##USID        10A  O  2 68                            
    A                                      COLOR(GRN)                  
    
    A          R SCREEN1                                               
    A                                      OVERLAY                     
    A                                      RTNCSRLOC(&CSRRCD1 &CSRFLD1 
    A            CSRRCD1       10A  H                                  
    A            CSRFLD1       10A  H                                  
    A            CSRPO1         4S 0H                                  
                                                                       
    A  26                              4  2'Company Code . . . . . :'  
    A  26                                  COLOR(GRN)                  
    A  26        ##COM_CDE     10A  B  4 27                            
    A  26   N95                                                        
    A  26N45                               COLOR(WHT)                  
    A  26 45 95                            DSPATR(RI)                  
    A  26 45 95                            COLOR(RED)                  
    A  26 45                               DSPATR(PC)                  
                                                                       
    A          R SCREEN2                                               
    A  98                                  OVERLAY                     
    A                                      RTNCSRLOC(&CSRRCD2 &CSRFLD2 
    A            CSRRCD2       10A  H                                  
    A            CSRFLD2       10A  H                                  
    A            CSRPO2         4S 0H                                  
    A          R RSTFL                     SFL                     
    A            ##INP          1A  B 11 02COLOR(WHT)              
    A            ##BNFID       10A    11  4COLOR(GRN)              
    A            ##BNFNAM      35A    11 22COLOR(GRN)              
    A            ##BNFAB       20A    11 61COLOR(GRN)              
                                                                   
    A          R RTSFLCTL                  SFLCTL(RSTFL)           
    A                                      SFLSIZ(9999)            
    A                                      SFLPAG(0009)            
    A  32                                  SFLEND(*MORE)               
    A  98                                  OVERLAY                     
    A  99                                  SFLDSP                      
    A N26                                  SFLDSPCTL                   
    A  26                                  SFLCLR                      
    A                                      RTNCSRLOC(&CSRRCD &CSRFLD & 
    A            CSRRCD        10A  H                                  
    A            CSRFLD        10A  H                                  
    A            CSRPOS         4S 0H                                  
                                                                       
    A            RECCOUNT       4S 0H      SFLRCDNBR(CURSOR)          
                                                                      
                                                                      
    A  30                              4  2' Code . . . . . :' 
    A  30                                  COLOR(GRN)                 
    A  30        ##COM_CDE     10A     4 27      
                                                                      
    A                                  9  4'Beneficiary ID'           
    A                                      COLOR(WHT)                 
    A                                  9 22'Beneficiary name'         
    A                                      COLOR(WHT)                 
    A          R FUNCTION                                 
    A                                      OVERLAY        
    A                                 22 15'F3=Exit'      
    A                                      COLOR(BLU)     
    A                                 22 25'F4=Prompt'    
    A                                      COLOR(BLU) 
    A                                 22 50'F8=Forward'   
    A                                      COLOR(BLU)     
    A                                 22 63'F12=Previous' 
    A                                      COLOR(BLU)     
    A                                 23  2'F6=TEST'      
    A                                      COLOR(BLU)     
    
     A          R ERROR                                           
     A                                      OVERLAY               
     A  25        ##ERR         76A  O 24  2COLOR(WHT)   [/B]

    screen 1 :
    -------------

    Code . . . . . :

    1=Validate F3=Exit F4=Prompt F8=Forward F12=Previous
    F6=TEST


    screen 2 and subfile
    -------------
    Code . . . . . : CTYM


    Beneficiary ID Beneficiary name Account number

    _ T5893 JFKSK 5001-201048-001
    _ 12344 ABCHRI 0002-572584-003


    1=Validate F3=Exit F4=Prompt F8=Forward F12=Previous
    F6=TEST




    what i want is that in my RPG program to have the F6 function key to see where the ##INP is equal to '1' so he can perform some code instructions

    Can you help me do this please?

  • #2
    Re: Subfile selections FULL CODe

    Function key : test for input in field ##INP

    Code:
    ** CMD-F6
    C                   IF        *INKF  
    ** Read changes in subfile                      
    C                   READC     SFL               
    C                   DOW       NOT %EOF             
    C                   IF        ##INP = '1'
    
    .. do something
    
    C                   ENDIF  
    C                   READC     SFL     
    C                   ENDDO 
    C                   ENDIF

    Comment


    • #3
      Re: Subfile selections FULL CODe

      Note: Remember !!!

      If you have more than 1 ##INP field set on '1'
      then your code in ...do something will repeat in the DOW loop!

      If you only want 1 record select from the subfile,
      use for ##INP Automatic record advance.

      CHECK(ER)

      In the ...do something
      you write something like a Chain with your key (##BNFID)

      Thats' it!
      Last edited by Marc_d; June 23, 2008, 08:57 AM.

      Comment


      • #4
        Re: Subfile selections FULL CODe

        Thanks But i tried like this to write a code when the user press 1 and enter to update the database but it is not working?

        Can i send u the code?

        Thanks alot in advance

        Comment


        • #5
          Re: Subfile selections FULL CODe

          Thanks Alot Marc
          It Got Resolved
          Thanks Alot

          Comment


          • #6
            Re: Subfile selections FULL CODe

            My thoughts: (common mistakes)

            1) Check you have your file ready for update

            UF :update file
            A :add
            K :key --> leaving this out is a common beginners mistake !!!

            in ->
            Code:
            FYRFILEL1  UF A E           K DISK

            2) After the Update --> Reload your SUBFILE to see the change !!!

            3) Are you sure you did not change you key in the subfile?
            Otherwhise you are key-ing the wrong record for update!



            4) If my thoughts didn't help , post your source code
            Last edited by Marc_d; June 24, 2008, 01:09 AM.

            Comment

            Working...
            X