ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

subfile field prompt

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

  • subfile field prompt

    hi all
    i would like to know if inside a subile containing a certain field
    if i can prompt on this field to change the subfile value?
    can this be done?

    thanks

  • #2
    Re: subfile field prompt

    Yes... read the prompted sfl record and process the prompted field.
    Regards

    Kit
    http://www.ecofitonline.com
    DeskfIT - ChangefIT - XrefIT
    ___________________________________
    There are only 3 kinds of people -
    Those that can count and those that can't.

    Comment


    • #3
      Re: subfile field prompt

      that what i tried to do but it is not taking the promt
      here is the part of the display file declaring the subfile

      Code:
       A          R RSTFL                     SFL                         
       A*                                     OVERLAY                     
       A                                      RTNCSRLOC(&CSRRCD2 &CSRFLD2 
       A            CSRRCD2       10A  H                                  
       A            CSRFLD2       10A  H                                  
       A            CSRPO2         4S 0H                                  
       A            ##INP          1A  B  9 02COLOR(WHT)
       A            ##BNFAB        4A  B  9 57COLOR(WHT)                  
       A            ##BNFAN        6A  B  9 62COLOR(WHT)                  
       A            ##BNFAS        3A  B  9 69COLOR(WHT)
      and here is the F4 code in my rpg code but when i press it nothing shows

      Code:
      C                   WHEN      SCRN=2 AND (CSRFLD2='##Bnfab'OR    
      C                             CSRFLD2='##BnfAN' OR CSRFLD2='##Bnf
      C                             AS')                               
      C                   DSPLY                   SCRN                 
      C                   CLEAR                   DSCCN                
      C                   EVAL      @PRMPT='Y'                         
      C                   EVAL      @NEW='N'                           
      C                   EVAL      @BLANK='N'                         
      C                   EVAL      @DECOD='B'                         
      C                   EVAL      %SUBST(DSCCN:1:4) = ##BNFAB        
      C                   EVAL      %SUBST(DSCCN:5:6) = ##BNFAN        
      C                   EVAL      %SUBST(DSCCN:11:3)= ##BNFAS        
      C                   CALL      'pgm01'      EQPVLIST             
      C                   EVAL      ##BNFAB  = %SUBST(DSCCN:1:4)       
      C                   EVAL      ##BNFAB  = %SUBST(DSCCN:1:4)          
      C                   EVAL      ##BNFAN  = %SUBST(DSCCN:5:6)          
      C                   EVAL      ##BNFAS  = %SUBST(DSCCN:11:3)   c                   endsl

      Comment


      • #4
        Re: subfile field prompt

        if you don't have already have coded SFLCSRRRN in your DDS

        add SFLCSRRRN (subfile recordnumber = for knowing the record line where you prompt for F4)

        and &CSRRRN ( cursor relative recordnumber SFL = returns the subfile line number)

        Code:
        A          R RSTFL                     SFL                         
        A*                                     OVERLAY                     
        A                                      RTNCSRLOC(&CSRRCD2 &CSRFLD2)
        A                                      SFLCSRRRN(&CSRRRN) 
        A            CSRRCD2       10A  H                                  
        A            CSRFLD2       10A  H                                  
        A            CSRPO2         4S 0H 
        A            CSRRRN         5S 0H
        This seems OK ! to me ! But if you need the subfile line where you data is
        Code:
        C                   WHEN      SCRN=2 AND (CSRFLD2='##Bnfab'OR    
        C                             CSRFLD2='##BnfAN' OR CSRFLD2='##Bnf
        C                             AS')            
        
        ** to get ( read ) the recordnumber 
        ** when you promt for F4, 
        ** add this to your code:
        ** chain the SFL with CSRRRN  
        
        C     CSRRRN        CHAIN     SFL
        ** shows what you just read from your SFL (subfile recordline)
        C                   DSPLY                   ##INP          
        C                   DSPLY                   ##BNFAB 
        C                   DSPLY                   ##BNFAN        
        C                   DSPLY                   ##BNFAS   
        
        you now exfmt a new screen or update
        what this CSRRRN CHAIN SFL does, is reread your SLF to get the record out of the subfile.

        Then you change the values you want to change and UPDATE your record. ( = PF or LF file, not SFL ! )

        Then you CLEAR the SLF and reload AGAIN ( the SFL) to get the new data redisplayed !

        Note:
        IF you want to update the record,
        make sure you DON'T changed the key fields (those defined in your LF ) ,
        or you ended UPDATING a WRONG record !

        Comment


        • #5
          Re: subfile field prompt

          please take a look here


          and


          jamie
          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


          • #6
            Re: subfile field prompt

            Thanks for the help
            but i don't want the window to be in the subfile
            i want the small window to appear when i press f6 and in this window i want the field to be able to be prompted
            got my idea?

            Comment


            • #7
              Re: subfile field prompt

              The logic is the same as any other screen... just the DDS specs are different.

              Code:
              1. display initial screen (if any)
              2. build & display next screen (could be a subfile)
              3. check for & display prompts (if any)
              4. update prompted fields in display (if neccessary)
              5. redisplay screen (if required) 
              6. validate & display errors and loop (if required)
              7. update files (if required)
              Regards

              Kit
              http://www.ecofitonline.com
              DeskfIT - ChangefIT - XrefIT
              ___________________________________
              There are only 3 kinds of people -
              Those that can count and those that can't.

              Comment


              • #8
                Re: subfile field prompt

                Hi,

                if your code looks really like this:
                PHP Code:
                C                   WHEN      SCRN=AND (CSRFLD2='##Bnfab'OR    
                C                             CSRFLD2='##BnfAN' OR CSRFLD2='##Bnf
                C                             AS'

                I can't imagine how you got it compiled:
                1. Field names in Display Files are never case sensitive.
                2. If you write field names within quotes, the names must be upper case, otherwise the WHEN-branch will never be executed.
                3. Further the 3rd field name is splittet over 2 rows, without an concatinating operator (+)

                Birgitta

                Comment


                • #9
                  Re: subfile field prompt

                  HEY
                  here is my screen i want when i press f6 on this screen to show a little popup window priompatable
                  are you getting my idea?

                  Code:
                                                                                                  
                   Company Code . . . . . : TTT         
                   Company Name . . . . . : TEST                                                  
                   Company Account. . . . : 0002-572584-001                                       
                                                                                                  
                     Beneficiary ID  Beneficiary Name                     Account Number   
                     TOTO            EMPLOYEE3                            0015 202020 003     
                           
                                                                                           Bottom 
                                                                                              
                                                                                                  
                   1=Select   F3=Exit   F4=Prompt   F5=Verify  F8=Forward   
                  F12=Previous          
                   F11=Validate          F6=UPDATE

                  Comment


                  • #10
                    Re: subfile field prompt

                    casporov - you are beginning to waste peoples time again, by not
                    showing actual code or explainning your exact problem. No one on this
                    site wants to write code for you.

                    Please look at examples that both Tom & I have posted.
                    Look at both the code and format...
                    compile them...put them in debug....Learn Learn Learn!

                    scan the site for &fld this will also explain how to use
                    RTNCSRLOC as marc posted above....


                    This will help you become a better programmer.

                    People are trying to help you are just not listening.
                    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


                    • #11
                      Re: subfile field prompt

                      jamief please i don't want again to be treated as am wasting people time i have put several time the full code am not hiding anything
                      but i still didn't get the solution to my problem which i want it by explaining i never said i want someone to write me code come on
                      i said many times that i want my little popup window to be promptable and here is the code but it is not compiling it gives meerror
                      i just need a hint about this issue why it is not compiling
                      i hope you understand what i mean
                      thanks for listening

                      Code:
                      A          R SCREEN5                                             
                      A                                      RTNCSRLOC(&CSRRCD1 &CSRFLD
                      A            CSRRCD1       10A  H                                
                      A            CSRFLD1       10A  H                                
                      A            CSRPO1         4S 0H                                
                      A                                      OVERLAY                   
                      A                                      WINDOW(15 12 04 55)       
                      A                                      WDWBORDER((*COLOR BLU))   
                      A                                  2  2'New Account Number:'     
                      A                                       COLOR(GRN)               
                      A            ##NACCB        4A  B  2 22DSPATR(HI)                
                      A            ##NACCN        6A  B  2 27DSPATR(HI)                
                      A            ##NACCS        3A  B  2 34DSPATR(HI)

                      Comment


                      • #12
                        Re: subfile field prompt

                        Again in this thread you have all the information you need to make this
                        work. please post the lines of code once more for the prompting.

                        do NOT exclude anything or manipulate the code...we want to see
                        exacly what you have in the program.....

                        this includes sections that lets say for example populate your variable
                        SCRN with a "2".

                        jamie
                        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


                        • #13
                          Re: subfile field prompt

                          in the display file posted #11 it gives me error
                          i need to have my display file compilted correctly in order to jump to the program lines?
                          got me?
                          thanks again

                          Comment


                          • #14
                            Re: subfile field prompt

                            your display with a splash of me added - i named it @@AD
                            Code:
                                 A*%%TS  SD  20080709  082305  FLANARY     REL-V5R4M0  5722-WDS
                                 A*%%EC
                                 A                                      DSPSIZ(24 80 *DS3)
                                 A                                      INDARA
                                 A                                      CF01
                                 A                                      CF02
                                 A                                      CF03
                                 A                                      CF04
                                 A                                      CF05
                                 A N70                                  CF06
                                 A N70                                  CF07
                                 A                                      CF08
                                 A                                      CF09
                                 A                                      CF10
                                 A                                      CF11
                                 A                                      CF12
                                 A                                      CF13
                                 A                                      CF14
                                 A                                      CF15
                                 A                                      CF16
                                 A                                      CF17
                                 A                                      CF18
                                 A                                      CF19
                                 A                                      CF20
                                 A                                      CF21
                                 A                                      CF22
                                 A                                      CF23
                                 A                                      CF24
                                 A N41                                  PAGEDOWN
                                 A                                      PAGEUP
                                 A          R SCREEN5
                                 A                                      OVERLAY
                                 A                                      RTNCSRLOC(&RECORD  &FIELD)
                                 A            RECORD        10A  H
                                 A            FIELD         10A  H
                                 A            CSRPO1         4S 0H
                                 A                                  2  2'NEW ACCOUNT NUMBER:'
                                 A                                       COLOR(GRN)
                                 A            ##NACCB        4A  B  2 22DSPATR(HI)
                                 A            ##NACCN        6A  B  2 27DSPATR(HI)
                                 A            ##NACCS        3A  B  2 34DSPATR(HI)
                            
                                 A          R WINDOW1
                                 A*%%TS  SD  20080709  082305  FLANARY     REL-V5R4M0  5722-WDS
                                 A                                      WINDOW(4 10 10 35)
                                 A                                  4  2'I'
                                 A                                  4  4'am'
                                 A                                  4  7'a'
                                 A                                  4  9'window'
                                 A                                  4 16'One'
                                 A          R WINDOW2
                                 A*%%TS  SD  20080709  082305  FLANARY     REL-V5R4M0  5722-WDS
                                 A                                      WINDOW(4 10 10 35)
                                 A                                  4  2'I'
                                 A                                  4  4'am'
                                 A                                  4  7'a'
                                 A                                  4  9'window'
                                 A                                  4 16'two'
                                 A          R WINDOW3
                                 A*%%TS  SD  20080709  082305  FLANARY     REL-V5R4M0  5722-WDS
                                 A                                      WINDOW(4 10 10 35)
                                 A                                  4  2'I'
                                 A                                  4  4'am'
                                 A                                  4  7'a'
                                 A                                  4  9'window'
                                 A                                  4 16'three'
                            the RPG name @@R
                            Code:
                                 f@@AD      cf   e             workstn INFDS(INFDS)
                            
                                  *
                                  * Variable Definition
                                  *
                                 d endscreen1      s              1    inz('N')
                                  //
                                  // Program Info
                                  //
                                 d                SDS
                                 d  @PGM                 001    010
                                 d  @PARMS               037    039  0
                                 d  @MSGDTA               91    170
                                 d  @MSGID               171    174
                                 d  @JOB                 244    253
                                 d  @USER                254    263
                                 d  @JOB#                264    269  0
                            
                                  // Command Keys
                            
                                 d Cmd01           c                   const(x'31')                         Cmd-1
                                 d Cmd02           c                   const(x'32')                         Cmd-2
                                 d LeaveProgram    c                   const(x'33')                         Cmd-3
                                 d Prompt          c                   const(x'34')                         Cmd-4
                                 d Cmd05           c                   const(x'35')                         Cmd-5
                                 d Cmd06           c                   const(x'36')                         Cmd-6
                                 d Cmd07           c                   const(x'37')                         Cmd-7
                                 d Cmd08           c                   const(x'38')                         Cmd-8
                                 d Cmd09           c                   const(x'39')                         Cmd-9
                                 d Cmd10           c                   const(x'3A')                         Cmd-10
                                 d Cmd11           c                   const(x'3B')                         Cmd-11
                                 d Cmd12           c                   const(x'3C')                         Cmd-12
                                 d Cmd13           c                   const(x'B1')                         Cmd-13
                                 d Cmd14           c                   const(x'B2')                         Cmd-14
                                 d Cmd15           c                   const(x'B3')                         Cmd-15
                                 d Cmd16           c                   const(x'B4')                         Cmd-16
                                 d Cmd17           c                   const(x'B5')                         Cmd-17
                                 d Cmd18           c                   const(x'B6')                         Cmd-18
                                 d Cmd19           c                   const(x'B7')                         Cmd-19
                                 d Cmd20           c                   const(x'B8')                         Cmd-20
                                 d Cmd21           c                   const(x'B9')                         Cmd-21
                                 d Cmd22           c                   const(x'BA')                         Cmd-22
                                 d Cmd23           c                   const(x'BB')                         Cmd-23
                                 d Cmd24           c                   const(x'BC')                         Cmd-24
                                 d EnterKey        c                   const(x'F1')
                                 d RollUp          c                   const(x'F5')                         Roll Up
                                 d RollDown        c                   const(x'F4')                         Roll Down
                            
                                 d Infds           ds                                                       INFDS data structure
                                 d Choice                369    369
                                 d Currec                378    379I 0
                            
                                  /Free
                            
                                    //--------------------------------------------------------
                                    // MAIN PROGRAM
                                    //--------------------------------------------------------
                            
                                        exsr  $Screen1;
                            
                                        *inlr = *on;
                            
                                    //--------------------------------------------------------
                                    // $Screen1 - parameter screen
                                    //--------------------------------------------------------
                                         begsr $Screen1;
                            
                                         reset  EndScreen1;
                                          dow  EndScreen1 = 'N';
                                           exfmt SCREEN5;
                            
                                           select;
                                        //
                                        // F3 pressed end the program F3 = LeaveProgram
                                        //
                                            when  Choice = LeaveProgram;
                                             EndScreen1 = 'Y';
                                        //
                                        // F4 pressed retrieve label information
                                        //
                                            when  Choice = prompt;
                                             exsr $prompt;
                                        //
                                        // Enter Key pressed
                                        //
                                            when  Choice = enterKey;
                            
                                            endsl;
                                           enddo;
                            
                                         endsr;
                            
                            
                                    //--------------------------------------------------------
                                    // $prompt - prompt by field
                                    //--------------------------------------------------------
                                         begsr $prompt;
                            
                            
                                          select;
                                           when field = '##NACCB';
                                            exfmt window1;
                                           when field = '##NACCN';
                                            exfmt window2;
                                           when field = '##NACCS';
                                            exfmt window3;
                                          endsl;
                            
                                         endsr;
                            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

                            Working...
                            X