Home > AS/400 Tips > iSeries programmer tips > Use function keys without response indicators
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Use function keys without response indicators


Jonathan Mason
06.06.2003
Rating: -3.69- (out of 5) Hall of fame tip of the month winner


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


A lot of programmers standardize on indicator usage for function keys within display file programs, e.g. *IN01 for F1, *IN03 for F3, etc, which is fine and readable if you are aware of the convention being used.

However, if you want to cut down on the number of indicators used in your program and make it easier to read and maintain then you should code your display files not to use response indicators and make use of the device dependent I/O feedback area of the File Information Data Structure instead.

Position 369 of the File Information Data Structure for display files contains a hex byte that represents the function key (or other grey key) pressed by the user.

By coding field @FNKEY in this position of the INFDS and then defining text constants for the appropriate function key value, I can test for the use of function keys within my programs by using:

 

                 @FNKEY     IFEQ $F5
                            ...
                            ...
                            ENDIF

as opposed to:

                 *IN05      IFEQ *ON
                            ...
                            ...
                            ENDIF 

The source snippets below show the coding needed within your RPG/400 program to use this technique.



Code

 RPG SOURCE SNIPPET
==================

     FWORKSTN CF  E                    WORKSTN      KINFDS INFDS
     F*   Display File
     F*----------------------------------------------------------------
     IINFDS       DS
     I                                      369 369 @FNKEY
     I* Function key values
     I              X'31'                 C         $F1
     I              X'32'                 C         $F2
     I              X'33'                 C         $F3
     I              X'34'                 C         $F4
     I              X'35'                 C         $F5
     I              X'36'                 C         $F6
     I              X'37'                 C         $F7
     I              X'38'                 C         $F8
     I              X'39'                 C         $F9
     I              X'3A'                 C         $F10
     I              X'3B'                 C         $F11
     I              X'3C'                 C         $F12
     I              X'B1'                 C         $F13
     I              X'B2'                 C         $F14
     I              X'B3'                 C         $F15
     I              X'B4'                 C         $F16
     I              X'B5'                 C         $F17
     I              X'B6'                 C         $F18
     I              X'B7'                 C         $F19
     I              X'B8'                 C         $F20
     I              X'B9'                 C         $F21
     I              X'BA'                 C         $F22
     I              X'BB'                 C         $F23
     I              X'BC'                 C         $F24
     I              X'BD'                 C         $CLEAR
     I              X'F1'                 C         $ENTER
     I              X'F3'                 C         $HELP
     I              X'F4'                 C         $RLLDN
     I              X'F5'                 C         $RLLUP
     I              X'F4'                 C         $PAGUP
     I              X'F5'                 C         $PAGDN
     I              X'F6'                 C         $PRINT
     I              X'F8'                 C         $BCKSP
     I              X'3F'                 C         $AUTO
     I*----------------------------------------------------------------
     C                     ...
     C                     ...
     C                     EXFMTxxxxxxxx
     C*
     C* Process function keys...
     C*
     C                     SELEC
     C           @FNKEY    WHEQ $F1
     C                     EXSR HELP
     C           @FNKEY    WHEQ $F3
     C                      ..
     C                     ...
     C           @FNKEY    WHEQ $ENTER
     C                     ...
     C                     ENDSL
     C*----------------------------------------------------------------

DDS SOURCE SNIPPET
==================
     A          R DSPFMAT
     A                                      CF01
     A                                      CF03
     A                                      PAGEDOWN
     A                                      etc...

  
  

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

Application Development
iSeries calling an .exe
Top 10 programmer tips
Formatted work job scheduler
Convert system date and time
Mixing free format code with embedded SQL
SQL update a field in one file from a field in another file
Webcasts for iSeries programmers
Programming advice from the pros
Easy code copying via the drag and drop method
Setting FTP time-outs

iSeries CL programming
Taking advantage of CL advancements, starting with V5R3
Checking in on your IBM i authorization lists
Running PHP open source applications: NOBODY needs authority
Simplify the process of converting a spool file from iSeries into an Excel spreadsheet
CL program for daily backups
An automated CL method of moving a query from AS/400 to Excel
Changing user password expiration
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Advanced Job Scheduler help

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts