Difference between revisions of "FKey AID Bytes"

From MidrangeWiki
Jump to: navigation, search
m (Put in category quick reference)
(Add links to references)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Category:Quick Reference]]
 
[[Category:Quick Reference]]
 +
= Function Key Attention Identifier Bytes =
 +
== Introduction To Function Key AID Bytes ==
 +
Function Key AID bytes can be used to determine which key was pressed in an interactive program.  Using the [[Workstation Data Structure]] the function key pressed can be retrieved from 369 position.  The AID byte will help you determine which actual key was pressed.  Using the AID bytes also allows you to perform any things without using indicators. The File Information Data Structure can be found in the RPG IV Reference, [https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzasd/filinda.htm File and Program Exceptions] and Errors section. Look at Device Specific Feedback. The full description of all the feedback areas offered by IBM i is in Files and file systems > Database file management > Reference >  [https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/dm/rbal3fedbk.htm Feedback area layouts]
 +
 +
== Examples of AID Byte Usage ==
 +
For example, using a display file with the F3 key defined as an exit key, we can define the CF function like this:<br>
 +
<pre>
 +
    A                                      CF03   
 +
</pre>
 +
 +
Inside the RPG program we can use the AID bytes to determine if the key pressed was in fact F3.
 +
<pre>
 +
    Dwsds            ds 
 +
    D fkey                  369    369a
 +
      /free
 +
        DoU FKey=x'33';
 +
            // do more stuff
 +
          If FKey=x'33';
 +
            Leave;
 +
          EndIf;
 +
        EndDo;
 +
      /end-free
 +
</pre>
 +
 +
Even better would be to define F3 as a named constant:
 +
<pre>
 +
    Dwsds            ds 
 +
    D fkey                  369    369a
 +
    D F3              c                    Const(x'33')
 +
      /free
 +
        DoU FKey=F3;
 +
            // do more stuff
 +
          If FKey=F3;
 +
            Leave;
 +
          EndIf;
 +
        EndDo;
 +
      /end-free
 +
</pre>
 +
 +
== Sample Named Constants ==
 
Here is a list of Function Key AID Bytes:
 
Here is a list of Function Key AID Bytes:
  
Line 35: Line 75:
 
       * Enter                                           
 
       * Enter                                           
 
     D Enter          C                  CONST(X'F1')
 
     D Enter          C                  CONST(X'F1')
 +
    D Home            C                  CONST(X'F8')
 +
 +
      * Mouse events linked to DDS MOUBTN keyword                                 
 +
    d ME00            c                  const(x'70')
 +
    d ME01            c                  const(x'71')
 +
    d ME02            c                  const(x'72')
 +
    d ME03            c                  const(x'73')
 +
    d ME04            c                  const(x'74')
 +
    d ME05            c                  const(x'75')
 +
    d ME06            c                  const(x'76')
 +
    d ME07            c                  const(x'77')
 +
    d ME08            c                  const(x'78')
 +
    d ME09            c                  const(x'79')
 +
    d ME10            c                  const(x'7A')
 +
    d ME11            c                  const(x'7B')
 +
    d ME12            c                  const(x'7C')
 +
    d ME13            c                  const(x'7D')
 +
    d ME14            c                  const(x'7E')
 
</pre>
 
</pre>

Latest revision as of 14:51, 28 July 2019

Function Key Attention Identifier Bytes

Introduction To Function Key AID Bytes

Function Key AID bytes can be used to determine which key was pressed in an interactive program. Using the Workstation Data Structure the function key pressed can be retrieved from 369 position. The AID byte will help you determine which actual key was pressed. Using the AID bytes also allows you to perform any things without using indicators. The File Information Data Structure can be found in the RPG IV Reference, File and Program Exceptions and Errors section. Look at Device Specific Feedback. The full description of all the feedback areas offered by IBM i is in Files and file systems > Database file management > Reference > Feedback area layouts

Examples of AID Byte Usage

For example, using a display file with the F3 key defined as an exit key, we can define the CF function like this:

     A                                      CF03     

Inside the RPG program we can use the AID bytes to determine if the key pressed was in fact F3.

     Dwsds             ds   
     D fkey                  369    369a
      /free
         DoU FKey=x'33';
            // do more stuff
           If FKey=x'33';
            Leave;
           EndIf;
         EndDo;
      /end-free

Even better would be to define F3 as a named constant:

     Dwsds             ds   
     D fkey                  369    369a
     D F3              c                    Const(x'33') 
      /free
         DoU FKey=F3;
            // do more stuff
           If FKey=F3;
            Leave;
           EndIf;
         EndDo;
      /end-free

Sample Named Constants

Here is a list of Function Key AID Bytes:

     D F1              C                   CONST(X'31')
     D F2              C                   CONST(X'32')
     D F3              C                   CONST(X'33')
     D F4              C                   CONST(X'34')
     D F5              C                   CONST(X'35')
     D F6              C                   CONST(X'36')
     D F7              C                   CONST(X'37')
     D F8              C                   CONST(X'38')
     D F9              C                   CONST(X'39')
     D F10             C                   CONST(X'3A')
     D F11             C                   CONST(X'3B')
     D F12             C                   CONST(X'3C')
     D F13             C                   CONST(X'B1')
     D F14             C                   CONST(X'B2')
     D F15             C                   CONST(X'B3')
     D F16             C                   CONST(X'B4')
     D F17             C                   CONST(X'B5')
     D F18             C                   CONST(X'B6')
     D F19             C                   CONST(X'B7')
     D F20             C                   CONST(X'B8')
     D F21             C                   CONST(X'B9')
     D F22             C                   CONST(X'BA')
     D F23             C                   CONST(X'BB')
     D F24             C                   CONST(X'BC')
      * Page Down/Roll Up                              
     D RollUp          C                   CONST(X'F5')
     D PageDown        C                   CONST(X'F5')
      * Page Up/Roll Down                              
     D RollDown        C                   CONST(X'F4')
     D PageUp          C                   CONST(X'F4')
      * Enter                                          
     D Enter           C                   CONST(X'F1')
     D Home            C                   CONST(X'F8')

      * Mouse events linked to DDS MOUBTN keyword                                  
     d ME00            c                   const(x'70')
     d ME01            c                   const(x'71')
     d ME02            c                   const(x'72')
     d ME03            c                   const(x'73')
     d ME04            c                   const(x'74')
     d ME05            c                   const(x'75')
     d ME06            c                   const(x'76')
     d ME07            c                   const(x'77')
     d ME08            c                   const(x'78')
     d ME09            c                   const(x'79')
     d ME10            c                   const(x'7A')
     d ME11            c                   const(x'7B')
     d ME12            c                   const(x'7C')
     d ME13            c                   const(x'7D')
     d ME14            c                   const(x'7E')