Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

TechTip: Eliminate Indicators in Display Programs

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

  • #16
    TechTip: Eliminate Indicators in Display Programs

    ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
    Hi, it was already difficult to handle the following display file. But then I had to add an additional indicator, to handle an other exception.
     A R1TNR R B 8 33REFFLD(TNR LLREFDP) A TEXT('Artikel-Nr.') A 12 DSPATR(RI) A N80 60N82 DSPATR(UL) A 80 AON60 AO 82 DSPATR(PR) A 12 DSPATR(PC) A N80 60N82 COLOR(YLW) A 80 AON60 AO 82 COLOR(WHT) A 83 R1LAB R B 19 33REFFLD(LAB LLREFDP) A TEXT('Lagerort') A 20 DSPATR(RI) A N80 60 DSPATR(UL) A 20 DSPATR(PC) A 80 AON83 AON60 DSPATR(PR) A N80 60 83 COLOR(TRQ) A N80 60N83 COLOR(YLW) A 80 AON60 COLOR(WHT) A 83 R1LBE R O 19 38REFFLD(LBE LLREFDP) A TEXT('Bezeichnung Lagerort') A COLOR(WHT) 
    The following snippet not only looks much easier, but its much easier to handle the different situations in the RPG program (where setting paranthesis is allowed).
     A A1TNR 1A P TEXT('Display-Attribute für – A Artikel-Nr.') A A1LAB 1A P TEXT('Display-Attribute für Lager') A R1TX11 30 O 6 2TEXT('Artikel-Nr.') A MSGID(FTX 0503 LLMSGF) A R1TNR R B 6 33REFFLD(TNR LLREFDP) A TEXT('Artikel-Nr.') A DSPATR(&A1TNR) A R1TX13 30 O 19 2TEXT('Lagerort') A MSGID(FTX 4668 LLMSGF) A R1LAB R B 19 33REFFLD(LAB LLREFDP) A TEXT('Lagerort') A DSPATR(&A1LAB) 
    Birgitta

    Comment


    • #17
      TechTip: Eliminate Indicators in Display Programs

      ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
      The documentation is not terrible clear and possibly just wrong. Both versions of the code I have attached below compile correctly and function as you would expect. Also, I have attached the link to the RPG ILE reference for V5R4. Check out the INDDS rules. RPG ILE V5R4 reference Good luck, Jeff
      Code

      Comment


      • #18
        TechTip: Eliminate Indicators in Display Programs

        ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
        DougCMH wrote: > I pulled this from the RPG Reference on the V5R4 InfoCenter: > > Indicator Data Structure > ... > * It can only have fields of indicator format. ... Oops. The compiler is right, the manual is wrong.

        Comment


        • #19
          TechTip: Eliminate Indicators in Display Programs

          ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
          Isn't that always the case, Barbara? Joe

          Comment


          • #20
            TechTip: Eliminate Indicators in Display Programs

            ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
            Joe Pluta wrote: > Isn't that always the case, Barbara? > > > Yep, pretty much. My software engineering professor said that as soon as a product is in the hands of a user, the only valid specification for that product is the product itself. But in this particular case, it wasn't an accidental bug-turned-feature. It was a deliberate decision to support both character and indicator subfields for INDDS.

            Comment


            • #21
              TechTip: Eliminate Indicators in Display Programs

              ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
              I also will set up variables valid/notvalid, etc. It makes the code much more readable as I would rather see "If pTestAddr = Valid" then "If pTestAddr = *on". (pTestAddr refering to a procedure that returns an indicator variable).

              Comment


              • #22
                TechTip: Eliminate Indicators in Display Programs

                ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
                Which is why I prefer to use completely meaningful names like TestAddressIsValid. Then I can just say "If TestAddressIsValid". By using the name of the Boolean to completely describe the *ON condition, you can avoid having to do any comparison at all. Joe

                Comment


                • #23
                  TechTip: Eliminate Indicators in Display Programs

                  ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
                  I name my procedures with names like isValidCustomer. So except for my dyslexia the meaning is all in the name. ;-) Jeff

                  Comment


                  • #24
                    TechTip: Eliminate Indicators in Display Programs

                    ** This thread discusses the article: TechTip: Eliminate Indicators in Display Programs **
                    And actually that's the standard for the OO world. If you have a boolean, the getter for the boolean is normally isVariableName. Thus you name your booleans to indicate the condition name. For example, I might have a boolean named numeric for a field, and then I can write "if field.isNumeric()". That's pretty self-documenting. And you could do that with a qualified data structrue just as easily if you name the fields with the "is" prefix. If you have a data structure named Customer with an indicator named isOnCreditHold, you could write "if Customer.isOnCreditHold;". Joe

                    Comment

                    Working...
                    X