ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Indicator data structure

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

  • Indicator data structure

    I have some doubts on indicator data structure.well anyone plz brief me about INDARA keyword.all i know that it separates the indicators defined in display file from 99 program indicator. so my questions are
    1. why we need to separate the same from 99 program indicator.
    2. what is the use of INDDS keyword.
    3. difference between overlaying subfield and DS.
    4. when to use pointer for indicator data structure

  • #2
    I'll put a couple comments in. Here are a few source lines from a short test program that I was using for display attributes:
    Code:
         FTSTDONLY  cf   e             workstn indDS( ws )
    
         D ws              ds                  qualified
         d  PRtgl                          n   overlay( ws :  1 )
         d  F3Exit                         n   overlay( ws :  3 )
         d  daULRI                         n   overlay( ws : 61 )
         d  daPRULRI                       n   overlay( ws : 62 )
         d  daPRRI                         n   overlay( ws : 63 )
         d  daPR                           n   overlay( ws : 64 )
    
                 select ;
                  when ws.daPR ;
                    ws.daPR      = *off ;
                    ws.daULRI    = *on ;
                  other ;
                    ws.daULRI    = *on ;
                  endsl ;
    The INDDS( ws ) keyword names the DS where display file indicators will be stored in the program. The OVERLAY() positions refer to the positions that result in the display file INDARA structure.

    All of these indicators are completely separate from the 99 program indicators. That means that all 99 program indicators are still available for other uses.

    In the code, references to the display indicators is by qualified name, e.g., "ws.daPR" refers to indicator 64 in the display file. It does not refer to *IN(64) in the program. Using names makes it easier to recognize what an indicator's purpose is.

    The "ws.daPR" indicator name tells me it's a workstation ("ws") indicator that I'm using to track the state of the 'PROTECT' ("PR") display attribute ("da"). I'm using simple abbreviations because the full program is only for my personal testing. In a production program, I might have a display file that has "F24=More keys" defined, and I might name that indicator "F24Morekeys" (i.e., "ws.F24Morekeys") in the program.

    Here's a short segment of the DSPF:
    Code:
    0025.00      A            FLD002         3A  B  6 21                                         140618
    0026.00      A  61                                  DSPATR(&HIRI)                            141015
    0027.00      A  99                                  DSPATR(&ULRI)                            141015
    0028.00      A  62                                  DSPATR(&PRULRI)                          140618
    0029.00      A  63                                  DSPATR(&PRRI)                            140618
    0030.00      A  64                                  DSPATR(&PR)                              140618
    0031.00      A  99                                  DSPATR(&HI)                              141015
    0032.00      A  61                              6 27'61'                                     140618
    0033.00      A  62                              6 31'62'                                     140618
    0034.00      A  63                              6 35'63'                                     140618
    0035.00      A  64                              6 39'64'                                     140618
    0036.00      A            FLD003         3A  B  7 21DSPATR(&DA)                              140618
    Indicators 61 through 64 are the most meaningful ones in this case, although 'F3=Exit' is also defined for CF03 and I have display indicator 01 defined for a secondary purpose that is unrelated to this post.

    You can compare the defined display indicator numbers against the INDDS OVERLAY() parameters to see how the parameters match up with the indicator numbers, e.g., display indicator 61 is declared in the INDDS with "overlay( ws : 61 )".

    I'm not sure what question #3 means, and I haven't seen any reason to use a pointer for this.

    Perhaps ideally, a site should have standard definitions for common display indicators and bring them into all programs with a /COPY or /INCLUDE statement.
    Last edited by tomliotta; August 15, 2017, 10:12 AM. Reason: Edited to include DSPF indicator source and comments
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      When you overlay the DS, you are basically specifying the position of the subfield within the DS. When you overlay a subfield, you are specifying the position of the new subfield relative to the overlaid subfield.

      In free-form declarations, the OVERLAY keyword can only be used to overlay subfields. It's not allowed to overlay the DS; you have to use the POS keyword instead.

      Code:
      D indds           ds                  qualified                   
      D   exit                          n   overlay(indds : 3)          
      D   refresh                       n   overlay(indds : 5)         
      D  
      
      dcl-ds indds qualified;      
         exit    ind pos(3);       
         refresh ind pos(5);       
      end-ds;

      Comment


      • #4
        thanx for clearing my doubts

        Comment

        Working...
        X