ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Display file keyword

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display file keyword

    Hello All,

    I have a numeric field(5 length), and say at run time, it is fetching a value 9 in ths field,
    now when i put a value 1 at the right most part of that field
    and press enter key, the value populated in PF-file is 10009,
    but i want 19(don't want those 0),
    what display file keyword should i used to have a control of this?

    Thanks in advance

  • #2
    Re: Display file keyword

    then press the 1 followed by the 9 then press the field exit key then enter. Works much better that way.

    There is not display file keyword for what you want to do. If you want 19 then key 19.
    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

    Comment


    • #3
      Re: Display file keyword

      yes...as Bill said....our numeric system is based on strict rules.

      this is 19 this is not 1 9

      But you might change the field to:

      Code:
      A            C1QTY          4Y 0B 20 50EDTCDE(Z)       
      A                                      CHECK(FE)       
      A                                      CHECK(RZ)
      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


      • #4
        Re: Display file keyword

        Sure, you can code it, but why should you use it for?



        DDS: NUMD

        Code:
        A                                      DSPSIZ(24 80 *DS3)            
        A          R F00                                                     
        A                                  6 13'NR'                          
        A            NR             1Y 0B  6 17CHECK(ER)                     
        A                                      DSPATR(PC)                    
        A                                      EDTCDE(4)                     
        A                                  4  7'TEST FOR NUMBER 19'          
        A                                      DSPATR(HI)                    
        A                                  6 25'NUMBER'                      
        A            NUMBER         4Y 0O  6 20DSPATR(HI)                    
        A*                                     EDTCDE(3)                     
        A                                  6  7'INPUT'
        RPGIV: NUM

        Code:
        *************************************************************************
         ** Number DEMO                                                         **
         *************************************************************************
        ** D I S P L A Y                                                          
        FNUMD      CF   E             WORKSTN                                     
        ** INIT FIELDS                                                            
        C                   EVAL      NUMBER = 9                                  
        ** LOOP                                                                   
        C                   DOW       NUMBER <> 19                                
        C                   IF        NUMBER > 999                                 
        C                   EVAL      NUMBER = 9                            
        C                   ENDIF                                                 
        C                   EXFMT     F00                                         
        C                   EVAL      NUMBER = %int(%char(NR) + %char(NUMBER))    
        C                   CLEAR                   NR                            
        C                   ENDDO 
        C* redisplay screen , enter to leave                                               
        C                   EXFMT     F00                                         
        C     NUMBER        DSPLY                                  
        C                   SETON                                        LR       
        C                   RETURN



        The only way I can see It usefull for, is to enter PIN codes or a Password.
        See also Post: Password Character. http://www.code400.com/forum/showthread.php?t=5688


        Note: With this method you can not use backspace if you keyed a wrong number.
        Just what you NEED for PIN codes or a Password ! ! !
        Last edited by Marc_d; July 1, 2008, 08:05 AM. Reason: Updated: replaced in IF clear field number with NUMBER = 9

        Comment


        • #5
          Re: Display file keyword

          Hi All,

          I have understood all that you have said and it is really meaningful to technical people, but for a layman user who is working on an application of AS400 may not know the features of AS400, and so he is doing that on the screen and expecting not to have those zero,as he is not typing it on the screen.

          Can anyone help to find a keyword of displayfile which will help to sort out this problem?

          Regards....

          Comment


          • #6
            Re: Display file keyword

            If you are new to the AS400 then, YES,
            it is confused to see that there is a difference between
            ENTER end RETURN !

            You could code in your DDS your numberfields with:

            EDTCDE(4)
            if you want no *zeros displayed in an DDS number field.

            or

            EDTCDE(3)
            if you want no leading *zeros, but only if it is 0 (zero) in an DDS number field.

            Example: a 4 digits number
            IN YOUR DDS YOU CODE IT LIKE

            Code:
            A            yournbr        4Y 0B  2  2EDTCDE(4)
            If your number is 0 (zero)

            what you get on your screen when you use EDTCDE(4)
            you see on your screen ____ ( you seen no 0 zero! )

            what you get on your screen when you use EDTCDE(3)
            you see on your screen ___0 ( you see 0 zero but not 0000 !)

            Example:
            your number is now for example 9

            what you get on your screen when you use EDTCDE(4)
            you see on your screen ___9 ( you seen no zeros like 0009! )

            what you get on your screen when you use EDTCDE(3)
            you see on your screen ___9 ( you seen no zeros like 0009! )


            In your case use EDTCDE(4)

            Note: Rember !
            If you press the ENTER key
            or the RETURN key on the AS400
            they are NOT the same !

            they behave different than on Windows !

            What you want to do in the first time ,
            you can't even do this in EXCEL !

            Comment


            • #7
              Re: Display file keyword

              i repeat

              Code:
              A            C1QTY          4Y 0B 20 50EDTCDE(Z)       
              A                                      CHECK(FE)       
              A                                      CHECK(RZ)
              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
                Code saved to my snippetsfile as nr 4597

                To Jamie,

                Strangly, I have always used EDTCDE(Z) with printerfiles.

                I was almost forgotten that you could use it for displayfiles .

                From now I 'll start useing it more for displayfiles.

                Thanks !

                Comment


                • #9
                  editcode 'Z' From the red into the black.

                  More info on editcodes:



                  Note that:
                  The Z edit code removes the sign (plus or minus) from and suppresses the leading zeros of a numeric field.

                  Allways know what you are doing !

                  Comment


                  • #10
                    Re: Display file keyword

                    Hello Marc_D,

                    I understand what you said, you have explained the different view the display screen will have with edtcde(3) and edtcde(4), but this will not solve my problem. In both the case if user has 1 in rightmost part of the field like this 1__9,and press Enter key,then in the database it will get updated as 1009,which is not acceptable by the user, he wants as 19 instead. since the user is not typing those '0' ,so he is expecting as 19 to get updated in database.

                    Can anyone plz help?

                    Comment


                    • #11
                      Re: Display file keyword

                      rcode400 ....I have answered your question twice and today you enter a *NEW post with the same query........I deleted it!

                      Test my solution first please.

                      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


                      • #12
                        Re: Display file keyword

                        Hi Jamie,

                        Your code has CHECK(FE) , so the user has to do the mandatory field exit,which will remove the 9 from the rightmost part of the screen,and the database will get updated with value of 1, instead of 19.

                        So,CHECK(FE) will not help in this senerio., anyway thanks for all your help.
                        Let me see if i can find this from any other forum groups.

                        There is a way to do this, and a display file keyword will control this, but i have to find it out.

                        Regards,.....................

                        Comment


                        • #13
                          Re: Display file keyword

                          Good luck searching, rcode400 !

                          And if you find it, please, post your findings back here !

                          Comment


                          • #14
                            Re: Display file keyword

                            Originally posted by rcode400 View Post
                            Hi Jamie,

                            Your code has CHECK(FE) , so the user has to do the mandatory field exit,which will remove the 9 from the rightmost part of the screen,and the database will get updated with value of 1, instead of 19.

                            So,CHECK(FE) will not help in this senerio., anyway thanks for all your help.
                            Let me see if i can find this from any other forum groups.

                            There is a way to do this, and a display file keyword will control this, but i have to find it out.

                            Regards,.....................
                            If the users can't press the following keys in the correct sequence, then educate them or fire them.

                            19<Field-Exit><Enter>

                            Truly it's not hard to do !

                            It is not practicle for the company to spend $$$ to code for this "exception" so a user does not have to press an extra keystroke !!!
                            Greg Craill: "Life's hard - Get a helmet !!"

                            Comment


                            • #15
                              Re: Display file keyword

                              I agree, this is poor policy to allow the users to enter data this way. However, this may work.

                              Define the display field as a char field. When the user enters the "1" in the left position it should return 1___9
                              Convert this field in RPG numField = %dec(charField:5:0)
                              This should convert to 00019, because %dec ignores blanks.

                              PS - I haven't tested this yet.

                              Comment

                              Working...
                              X