ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

QsnRtvMod API

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

  • QsnRtvMod API

    I have found a lot of examples on the web for using one of the Dynamic Screen Manager API's to return the current screen size. The API is QsnRtvMod. Unfortunately though, when I compile the source it is unable to find that API during the binding step. So I did a search and that object does not exist on my system.

    I figure the API must be buried in a module or service program that I need to bind with my program. The question is, which one? Does anyone know where this API is buried or do I need to download it from someplace?

    Thanks in advance!

    Soup

  • #2
    Re: QsnRtvMod API

    Service Program: QSNAPI

    from here....
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: QsnRtvMod API

      Cool beans! Thanks!

      Comment


      • #4
        Re: QsnRtvMod API

        FWIW i've never had to bind to the service program for DSM APIs just compile and done. here's a link to a save file that contains an app using DSM APIs you can look at for some potential guidance
        http://www.tommyholden.com/downloads/save%20files/krcontrol.savf

        here's the write up i did on that app for system i network http://systeminetwork.com/article/dy...le-maintenance
        Last edited by tomholden; May 29, 2008, 09:04 AM.
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment


        • #5
          Re: QsnRtvMod API

          BTW the screen size is also in the INFDS and is much easier to use than the API

          http://publib.boulder.ibm.com/iserie...htm#HDRFILINDA
          I'm not anti-social, I just don't like people -Tommy Holden

          Comment


          • #6
            Re: QsnRtvMod API

            Originally posted by tomholden View Post
            BTW the screen size is also in the INFDS and is much easier to use than the API

            http://publib.boulder.ibm.com/iserie...htm#HDRFILINDA
            I'm not sure that option will work. The value in the INFDS will display the screen size as defined by the window I am currently opening. I want to determine the size of the screen that is currently displayed (possibly by an earlier program) so that I can determine where and how to position a window. Feel free to correct me if I am wrong in my logic.

            By the way, that API works like a charm.

            Comment


            • #7
              Re: QsnRtvMod API

              you're correct...it shows the current window attributes
              I'm not anti-social, I just don't like people -Tommy Holden

              Comment


              • #8
                Re: QsnRtvMod API

                Originally posted by soup_dog View Post
                ... so that I can determine where and how to position a window. ...
                Another option could be to let the system decide where to put the window. The top left corner being 1 line lower than the cursor position if there is is enough space to the left and below to fit the window.
                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


                • #9
                  Re: QsnRtvMod API

                  Originally posted by tomholden View Post
                  FWIW i've never had to bind to the service program for DSM APIs just compile and done. here's a link to a save file that contains an app using DSM APIs you can look at for some potential guidance
                  http://www.tommyholden.com/downloads...krcontrol.savf
                  hi tomholden,
                  this is a good source, i want to learn about DSM API from basic.
                  i've copy it but i don't understand.

                  may you can explain the function of program that you made ???


                  thx u

                  Comment


                  • #10
                    Re: QsnRtvMod API

                    This is what I found on the net :

                    Since I've had private requests for what I use, I'm posting relevant portions of the code below.
                    The code was written to support a V3R2 client, so it doesn't use compiler directives like /DEFINE, names are limited to 10 chars, and it returns 1A character values which really should be type N indicator values.
                    In the code below, I've only changed return values to N where applicable.
                    Using /DEFINE is left as an excercise for the reader.

                    Most of the subprocedures do not require an argument, but since RPG IV doesn't allow you to append empty () to a proc name (yet!), I typically define an optional/omissible dummy argument to make it clear a procedure is being called as opposed to a variable being referenced, e.g.
                    Code:
                         C                   If        Is27x132OK( *Omit )
                         C                   ...
                         C                   Else
                         C                   ...
                         C                   Endif
                    The same thing could be coded leaving out the ( *Omit ) if desired.

                    First the prototypes (put into a /COPY member):
                    Code:
                          * Prototype to determine if device is capable of 27x132 mode
                         D Is27x132OK      PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to determine if device is capable of 24x80 mode
                         D Is24x80OK       PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to check if a given screen mode is valid.  The   
                          * first argument, Mode, can be '3' for 24x80 or '4' for 27x132.
                         D ChkScrMode      PR              N
                         D  Mode                          1A   Const
                    
                          * Prototype to retrieve current screen mode (3=24x80; 4=27x132)
                         D RtvScrMode      PR             1A
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to retrieve current screen dimensions
                         D RtvScrDim       PR
                         D  Rows                          5I 0
                         D  Cols                          5I 0
                    
                          * Prototype to determine if WS supports color
                         D IsColorDev      PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to determine if WS supports extended foreground colors
                         D IsExtColor      PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to determine if WS supports Write Extended Attribute
                         D IsWeaDev        PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to determine if WS ctl supports Enhanced User Interface
                         D IsEuiCtl        PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to determine if WS uses GUI-like characters
                         D IsGuiDev        PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                          * Prototype to determine if WS has a pointer device available
                         D HasMouse        PR              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    Then here is the service program source to go with it:
                    Code:
                         H NoMain
                         H Option(*SrcStmt: *NoDebugIO)
                    
                          * DS used by QsnQry5250 receiver variable
                         D QryRcvDS        DS
                         D  QryBytRtn                    10I 0
                         D  QryBytAvl                    10I 0
                         D  QryStatus                     1A
                         D  QryWsCtlU                     5I 0
                         D  QryCodeLvl                    3A
                         D                               16A
                         D  QryWsType                     1A
                         D  QryMchType                    4A
                         D  QryModel                      3A
                         D  QryKbdID                      1A
                         D  QryExtKbd                     1A
                         D  QryPcKbd                      1A
                         D  QrySerial                     4A
                         D  QryMaxInp                     5I 0
                         D  QryCtlUCst                    2A
                         D                                1A
                         D  QryDevCap                    12A
                         D   QryDev1                      1A    Overlay(QryDevCap:1)
                         D   QryDev2                      1A    Overlay(QryDevCap:2)
                         D   QryDev3                      1A    Overlay(QryDevCap:3)
                         D   QryDev4                      1A    Overlay(QryDevCap:4)
                         D   QryDev5                      1A    Overlay(QryDevCap:5)
                         D   QryDev6                      1A    Overlay(QryDevCap:6)
                         D   QryDev7                      1A    Overlay(QryDevCap:7)
                         D   QryDev8                      1A    Overlay(QryDevCap:8)
                         D   QryDev9                      1A    Overlay(QryDevCap:9)
                         D   QryDev10                     1A    Overlay(QryDevCap:10)
                         D   QryDev11                     1A    Overlay(QryDevCap:11)
                         D   QryDev12                     1A    Overlay(QryDevCap:12)
                         D  QryGridBuf                    1A
                         D                                9A
                    
                         D QryRcvLen       S             10I 0 Inz( %size( QryRcvDS ))
                    
                         D ApiErrorDS      DS
                         D  ErrBytPrv                    10I 0 Inz( %size( ApiErrorDS ) )
                         D  ErrBytAvl                    10I 0 Inz( 0 )
                         D  ErrMsgID                      7A
                         D                                1A
                         D  ErrMsgDta                   256A
                    
                         D Qry5250         PR                  ExtProc( 'QsnQry5250' )
                         D  RcvVar                             Like( QryRcvDS )
                         D  RcvVarLen                    10I 0
                         D  ErrorDS                            Like( ApiErrorDS )
                    
                         D/Copy (prototypes listed above; whatever you called it)
                    
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if device is capable of 27x132 mode
                         P Is27x132OK      B                   Export
                    
                         D Is27x132OK      PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         C                   Return    ChkScrMode( '4' )
                    
                         P Is27x132OK      E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if device is capable of 24x80 mode
                         P Is24x80OK       B                   Export
                    
                         D Is24x80OK       PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         C                   Return    ChkScrMode( '3' )
                    
                         P Is24x80OK       E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to check if a given screen mode is valid.  The   
                          * first argument, Mode, can be '3' for 24x80 or '4' for 27x132.
                         P ChkScrMode      B                   Export
                    
                         D ChkScrMode      PI              N
                         D  Mode                          1A   Const
                    
                         D IsValid         S              1A
                    
                         D QryMode         PR                  ExtProc( 'QsnQryModSup' )
                         D  DspMode                       1A   Const
                         D  IsValid                        N
                         D  Handle                       10I 0 Options( *Omit )
                         D  ErrorDS                            Options( *Omit: *Varsize )
                         D                                     Like( ApiErrorDS )
                    
                         C                   Callp     QryMode( Mode: IsValid: *Omit: *Omit )
                         C                   Return    IsValid
                    
                         P ChkScrMode      E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to retrieve current screen mode (3=24x80; 4=27x132)
                         P RtvScrMode      B                   Export
                    
                         D RtvScrMode      PI             1A
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         D RtvMode         PR                  ExtProc( 'QsnRtvMod' )
                         D  DspMode                       1A
                         D  Handle                       10I 0 Options( *Omit )
                         D  ErrorDS                            Options( *Omit: *Varsize )
                         D                                     Like( ApiErrorDS )
                    
                         D CurMode         S              1A   Inz( '0' )
                    
                         C                   Callp     RtvMode( CurMode: *Omit: *Omit )
                         C                   Return    CurMode
                    
                         P RtvScrMode      E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to retrieve current screen dimensions
                         P RtvScrDim       B                   Export
                    
                         D RtvScrDim       PI
                         D  Rows                          5I 0
                         D  Cols                          5I 0
                    
                         D R               S             10I 0
                         D C               S             10I 0
                    
                         D RtvSize         PR                  ExtProc( 'QsnRtvScrDim' )
                         D  NumRow                       10I 0
                         D  NumCol                       10I 0
                         D  Handle                       10I 0 Options( *Omit )
                         D  ErrorDS                            Options( *Omit: *Varsize )
                         D                                     Like( ApiErrorDS )
                    
                         C                   Callp     RtvSize( R: C: *Omit: *Omit )
                         C                   Eval      Rows = R
                         C                   Eval      Cols = C
                    
                         C                   Return
                    
                         P RtvScrDim       E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if WS supports color
                         P IsColorDev      B                   Export
                    
                         D IsColorDev      PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         D QryColor        PR                  ExtProc( 'QsnQryColorSup' )
                         D  Color                          N
                         D  Handle                       10I 0 Options( *Omit )
                         D  ErrorDS                            Options( *Omit: *Varsize )
                         D                                     Like( ApiErrorDS )
                    
                         D IsColor         S               N   Inz( '0' )
                    
                         C                   Callp     QryColor( IsColor: *Omit: *Omit )
                    
                         C                   Return    IsColor
                    
                         P IsColorDev      E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if WS supports extended foreground colors
                         P IsExtColor      B                   Export
                    
                         D IsExtColor      PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         D  TempChar       S              1A
                    
                         C                   Callp     Qry5250( QryRcvDS: QryRcvLen: ApiErrorDS )
                         C                   Eval      TempChar = QryDev3
                         C                   Bitoff    '012345'      TempChar
                    
                         C                   If        TempChar = x'02'
                         C                   Return    *On
                         C                   Else
                         C                   Return    *Off
                         C                   Endif
                    
                         P IsExtColor      E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if WS supports Write Extended Attribute
                         P IsWeaDev        B                   Export
                    
                         D IsWeaDev        PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         C                   Callp     Qry5250( QryRcvDS: QryRcvLen: ApiErrorDS )
                         C                   Testb     '5'           QryDev3                  90
                    
                         C                   Return    *In90
                    
                         P IsWeaDev        E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if WS ctl supports Enhanced User Interface
                         P IsEuiCtl        B                   Export
                    
                         D IsEuiCtl        PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         C                   Callp     Qry5250( QryRcvDS: QryRcvLen: ApiErrorDS )
                         C                   Testb     '6'           QryDev5                  90
                    
                         C                   Return    *In90
                    
                         P IsEuiCtl        E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if WS uses GUI-like characters
                         P IsGuiDev        B                   Export
                    
                         D IsGuiDev        PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                         C                   Callp     Qry5250( QryRcvDS: QryRcvLen: ApiErrorDS )
                         C                   Testb     '5'           QryDev5                  90
                    
                         C                   Return    *In90
                    
                         P IsGuiDev        E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                          * Procedure to determine if WS has a pointer device available
                         P HasMouse        B                   Export
                    
                         D HasMouse        PI              N
                         D  Dummy                         1A   Options( *NoPass: *Omit )
                    
                    
                         C                   Callp     Qry5250( QryRcvDS: QryRcvLen: ApiErrorDS )
                         C                   Testb     '4'           QryDev5                  90
                    
                         C                   Return    *In90
                    
                         P HasMouse        E
                          * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    A few lines may have word wrapped in the message body, but fit on one line in a
                    source member. The TESTB operations have the indicator in columns 75-76 (EQ).

                    (c) Doug


                    >Doug, was there any particular reason to use the API over the INFDS method? Does the INFDS return incorrect info? It seemed a lot shorter...
                    I do it for several reasons:
                    - The INFDS requires the DSPF to already be open. DSM does not,
                    allowing you to determine the capability prior to opening a DSPF.
                    - The INFDS reports 24x80 if no DS4 formats exist in the display file
                    since, for the DSPF, the max rows/columns is DS3 format.
                    - I can put it in a service pgm with numerous other related routines, making the test a simple matter of coding the subprocedure call, which will then be similar to other tests I may want to make which the INFDS can not handle.

                    For example, my service program not only has a routine to check if the device is *capable* of 27x132, it has another one to determine the *current* state of the device.
                    This can be important in called programs which put up a window, because although the device is capable of 27x132, it may not necessarily be in that mode.

                    Like SEU, I think it is important to give the user the *option* to run in 24x80 if they prefer, even if the device is capable of 27x132. I want windows to appear in the proper mode, without the need to pass parameters to subprograms to tell it what mode to use.

                    Other routines in the service program return whether or not the device is capable of color, or "enhanced" user interface options, or GUI-like constructs like real borders, or extended foreground colors, or has a mouse attached, etc.

                    It is a simple matter to make short wrapper routines to test various attribute bits from QsnQry5250 or other DSM apis, and you can name them such that the intent is clear and program readability is improved.

                    Comment

                    Working...
                    X