ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Bypass the Attention Key

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

  • Bypass the Attention Key

    Does anyone have experience with this:

    I use the pre-attention key user exit to call my program (which does some function). My program (currently) doesn't manipulate the attention key capabilities. The program doesn't enable or disable anything having to do with the attention key.

    I want to condition calling the attention key program based upon what my program did. Basically, if my program processes then I want to bypass the user's attention key program.

    Currently, my program runs and then the attention key program runs and the user is forced to press F12 (or whatever) to get back to the application.

    I haven't used the SETATNPGM in my program, but I'd be willing to try. I think this is the path I need to follow but before I spend time going down that road, I wanted to check if someone has already been here. Thanks.

  • #2
    Re: Bypass the Attention Key

    Im not following just what you want to do.....

    can you explain a bit more?

    thanks
    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


    • #3
      Re: Bypass the Attention Key

      I'll try...

      On the iSeries you can set an IBM exit point (a.k.a. user exit) when a user presses the attention key. The name of the exit point is QIBM_QWT_PREATTNPGMS. What you do is register your program to do something before the iSeries goes on and processes the attention key.

      What I want to do is add code to my program that says, "Hey. If I did something (processed data, updated a file, whatever) then don't process the attention key." Basically, I want to bypass calling the attention key program.

      Now, I've read where you can use the SETATNPGM with various parameters to do various functions. I'm just wondering if anyone has experience with them and/or look to see if anyone has more experience with using this CL command than I do.

      Does this help?

      Comment


      • #4
        Re: Bypass the Attention Key

        Ive never had to do this .... but on my second favorite site on the web...
        there is an example of this with help & everything...



        Code:
        Set profile exit program & Retrieve profile exit program
        
        CBX107:
        
        /*  Description : Set profile exit program command                   */
        /*  Program function:  SETPRFEXIT command processing program         */
        /*                                                                   */
        /*  Program summary                                                  */
        /*  ---------------                                                  */
        /*  Work management APIs:                                            */
        /*    QWTSETPX       Set profile exit   Sets for a user profile      */
        /*                   program            the exit program to call     */
        /*                                      defined by the specified     */
        /*                                      format and the values of     */
        /*                                      the exit flags.              */
        /*                                                                   */
        /*    QWTRTVPX       Retrieve profile   Retrieves the values of      */
        /*                   exit program       the exit flags currently     */
        /*                                      set for the user profile     */
        /*                                      and the exit point format    */
        /*                                      specified.                   */
        /*                                                                   */
        /*  Programmer's notes:                                              */
        /*    Currently supported by the profile exit APIs are the           */
        /*    preattention and presystem request exit points                 */
        /*    QIBM_QWT_PREATTNPGMS respectively QIBM_QWT_SYSREQPGMS.         */
        /*    Both are managed through either the WRKREGINF facility         */
        /*    or the ADDEXITPGM and RMVEXITPGM commands.                     */
        /*                                                                   */
        /*                                                                   */
        /*  Compile options:                                                 */
        /*    CrtClPgm   Pgm( CBX107 )                                       */
        /*               SrcFile( QCLSRC )                                   */
        /*               SrcMbr( *PGM )                                      */
        /*                                                                   */
        /*-------------------------------------------------------------------*/
             Pgm      ( &UsrPrf                +
                        &XitFmt                +
                        &XitOpt                +
                      )
        
        /*-- Parameters:  ---------------------------------------------------*/
             Dcl        &UsrPrf      *Char    10
             Dcl        &XitFmt      *Char     8
             Dcl        &XitOpt      *Char    34
        
             Dcl        &PgmNbr      *Char     4   x'00000008'
             Dcl        &Flags       *Char    32
        
        /*-- Global error monitoring:  --------------------------------------*/
             MonMsg     CPF0000      *N        GoTo Error
        
        
             RtvUsrPrf  &UsrPrf       RtnUsrPrf( &UsrPrf )
        
             ChgVar     &Flags        %Sst( &XitOpt  3  32 )
        
             Call       QWTSETPX    ( &PgmNbr            +
                                      &Flags             +
                                      &XitFmt            +
                                      &UsrPrf            +
                                      x'00000000'        +
                                    )
        
             SndPgmMsg  Msg( 'Profile exit programs have been set.' )   +
                        MsgType( *COMP )
        
         Return:
             Return
        
        /*-- Error handling:  -----------------------------------------------*/
         Error:
             Call      QMHMOVPM    ( '    '                                  +
                                     '*DIAG'                                 +
                                     x'00000001'                             +
                                     '*PGMBDY'                               +
                                     x'00000001'                             +
                                     x'0000000800000000'                     +
                                   )
        
             Call      QMHRSNEM    ( '    '                                  +
                                     x'0000000800000000'                     +
                                   )
        
         EndPgm:
             EndPgm
        
        CBX1070:
        
        /*-------------------------------------------------------------------*/
        /*                                                                   */
        /*  Program function:  SETPRFEXIT prompt override program            */
        /*                                                                   */
        /*                                                                   */
        /*  Parameters:                                                      */
        /*    CmdNamQ     INPUT      Qualified command name                  */
        /*                                                                   */
        /*    KeyPrm1     INPUT      Key parameter indentifying the          */
        /*                           user profile to retrieve exit           */
        /*                           point information about.                */
        /*                                                                   */
        /*    KeyPrm2     INPUT      Key parameter identifying the           */
        /*                           format name of the exit point           */
        /*                           to retrieve information about.          */
        /*                                                                   */
        /*    CmdStr      OUTPUT     The formatted command prompt            */
        /*                           string returning the current            */
        /*                           activation status of the exit           */
        /*                           point's registered programs.            */
        /*                                                                   */
        /*                                                                   */
        /*  Compile options:                                                 */
        /*    CrtClPgm   Pgm( CBX107O )                                      */
        /*               SrcFile( QCLSRC )                                   */
        /*               SrcMbr( *PGM )                                      */
        /*                                                                   */
        /*                                                                   */
        /*-------------------------------------------------------------------*/
             Pgm      ( &CmdNamQ               +
                        &KeyPrm1               +
                        &KeyPrm2               +
                        &CmdStr                +
                      )
        
        /*-- Parameters:  ---------------------------------------------------*/
             Dcl        &CmdNamQ     *Char    20
             Dcl        &KeyPrm1     *Char    10
             Dcl        &KeyPrm2     *Char     8
             Dcl        &CmdStr      *Char  1024
        
             Dcl        &RcvVar      *Char    40
             Dcl        &RcvLen      *Char     4    x'00000028'
             Dcl        &Flags       *Char    32
        
             Dcl        &Value       *Char     4
             Dcl        &PgmFlg      *Dec      9
             Dcl        &NbrEnt      *Dec      5
             Dcl        &OffSet      *Dec      5    1
        
        /*-- Global error monitoring:  --------------------------------------*/
             MonMsg     CPF0000      *N             GoTo Error
        
        
             Call       QWTRTVPX    ( &RcvVar            +
                                      &RcvLen            +
                                      &KeyPrm2           +
                                      &KeyPrm1           +
                                      x'00000000'        )
        
             ChgVar     &NbrEnt       %Bin( &RcvVar  1  4 )
             ChgVar     &Flags        %Sst( &RcvVar  9 32 )
        
             ChgVar     %Sst( &CmdStr  1   2 )      x'0040'
             ChgVar     %Sst( &CmdStr  3  10 )      '?#EXITPGM('
        
        Next:
             ChgVar     &PgmFlg       %Bin( &Flags  &OffSet  4 )
        
             If       ( &PgmFlg   =   1  )     ChgVar    &Value    '*ON '
             Else                              ChgVar    &Value    '*OFF'
        
             ChgVar     &CmdStr     ( &CmdStr *Bcat  &Value )
             ChgVar     &OffSet     ( &OffSet + 4 )
        
             If       ( &OffSet   <   &NbrEnt * 4 )      Do
             GoTo       Next
             EndDo
        
             ChgVar     &CmdStr     ( &CmdStr *Bcat ')' )
        
         Return:
             Return
        
        /*-- Error handling:  -----------------------------------------------*/
         Error:
             SndPgmMsg  MsgId( CPF0011 )  MsgF( QCPFMSG )  MsgType( *ESCAPE )
         EndPgm:
             EndPgm
        
        
        Pls note: '?#EXITPGM(' ....  '#' neeeds to be changed to '<'
        
        CBX107P:
        
        .*-----------------------------------------------------------------------**
        .*
        .*  Compile options:
        .*
        .*    CrtPnlGrp PnlGrp( CBX107P )
        .*              SrcFile( QPNLSRC )
        .*              SrcMbr( *PNLGRP )
        .*
        .*-----------------------------------------------------------------------**
        :PNLGRP.
        :HELP NAME='SETPRFEXIT'.
        Set Profile Exit Program - Help
        :P.
        The Set Profile Exit command (SETPRFEXIT) activates or deactivates for
        the specified user profile, the exit program(s) registered for the exit
        point defined by the format parameter.
        :P.
        The current setting is retrieved for the specified user profile if the
        command is prompted prior to execution.
        :EHELP.
        :HELP NAME='SETPRFEXIT/USRPRF'.
        User profile (USRPRF) - Help
        :XH3.User profile (USRPRF)
        :P.
        Specifies the name of the user profile whose exit program setting you
        want to change.
        :P.
        The possible values are:
        :PARML.
        :PT.:PV.user-name:EPV.
        :PD.
        The name of the user profile that you want to change the profile exit
        program setting for.
        :PT.:PK.*CURRENT:EPK.
        :PD.
        The user profile that is currently running is used.
        :EPARML.
        :EHELP.
        :HELP NAME='SETPRFEXIT/FORMAT'.
        Exit program format (FORMAT) - Help
        :XH3.Exit program format (FORMAT)
        :P.
        The format name defines the specific exit program setting to change.
        :P.
        The possible values are:
        :PARML.
        :PT.:PK DEF.*SYSRQS:EPK.
        :PD.
        The presystem request program exit point setting is changed for the
        specified user profile.
        :PT.:PK.*ATTN:EPK.
        :PD.
        The preattention program exit point setting is changed for the
        specified user profile.
        :EPARML.
        :EHELP.
        :HELP NAME='SETPRFEXIT/EXITPGM'.
        Exit program option (EXITPGM) - Help
        :XH3.Exit program option (EXITPGM)
        :P.
        Specifies for the registered exit point programs in the order 1 to 8
        if the corresponding exit program should be activated, deactivated or
        have it's current setting remain unchanged.
        :P.
        The possible values are:
        :PARML.
        :PT.:PK.*SAME:EPK.
        :PD.
        The current setting remains unchanged for corresponding exit program.
        :PT.:PK.*ON:EPK.
        :PD.
        The corresponding exit program is activated for the specified user
        profile.
        :PT.:PK.*OFF:EPK.
        :PD.
        The corresponding exit program is deactivated for the specified user
        profile.
        :EPARML.
        :EHELP.
        :EPNLGRP.
        
        CBX107X:
        
        /*-------------------------------------------------------------------*/
        /*                                                                   */
        /*  Compile options:                                                 */
        /*                                                                   */
        /*    CrtCmd Cmd( SETPRFEXIT )                                       */
        /*           Pgm( CBX107 )                                           */
        /*           SrcMbr( CBX107X )                                       */
        /*           HlpPnlGrp( CBX107P )                                    */
        /*           HlpId( *CMD )                                           */
        /*           PmtOvrPgm( CBX107O )                                    */
        /*                                                                   */
        /*-------------------------------------------------------------------*/
                     Cmd        Prompt( 'Set Profile Exit Program' )
        
                     Parm       USRPRF        *Name                     +
                                Min( 1 )                                +
                                SpcVal(( *CURRENT ))                    +
                                Expr( *YES )                            +
                                Keyparm( *YES )                         +
                                Prompt( 'User profile' )
        
                     Parm       FORMAT        *Char      8              +
                                Rstd( *YES )                            +
                                Dft( *SYSRQS )                          +
                                SpcVal(( *SYSRQS  SREQ0100 )            +
                                       ( *ATTN    ATTN0100 ))           +
                                Expr( *YES )                            +
                                Keyparm( *YES )                         +
                                Prompt( 'Exit program format' )
        
                     Parm       EXITPGM       E0001                     +
                                Prompt( 'Exit program option' )
        
        
        E0001:       Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr( *YES )                               +
                                Prompt( 'Program 1' )
        
                     Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr(*YES)                                 +
                                Prompt( 'Program 2' )
        
                     Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr( *YES )                               +
                                Prompt( 'Program 3' )
        
                     Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr( *YES )                               +
                                Prompt( 'Program 4' )
        
                     Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr( *YES )                               +
                                Prompt( 'Program 5' )
        
                     Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr( *YES )                               +
                                Prompt( 'Program 6' )
        
                     Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr( *YES )                               +
                                Prompt( 'Program 7' )
        
                     Elem                    *INT4                         +
                                Rstd( *YES )                               +
                                Dft( *SAME )                               +
                                SpcVal(( *ON 1 ) ( *OFF 0 ) ( *SAME -1 ))  +
                                Expr( *YES )                               +
                                Prompt( 'Program 8' )
        
        Thanks to Carsten Flensburg
        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


        • #5
          Re: Bypass the Attention Key

          You can override the default attention key program (look into the QATNPGM system value, or the ATNPGM parameter of the CHGUSRPRF command) and make it run your program. Then your program can decide whether or not to forward the user on to the attention key default program (accessed with the command GO ASSIST), or to return to the caller.

          If you want to control whether or not the ASSIST menu is shown to the user, the exit point program is not the way to go.
          Last edited by littlepd; July 17, 2009, 09:07 AM.
          "Time passes, but sometimes it beats the <crap> out of you as it goes."

          Comment

          Working...
          X