Define those function keys

I use this tool in any program utilizing screens and function keys. The keys can actually make sense when reading the program and open up indiciators if needed by the program.

When the display file is created and the function keys are defined, don't set an indicator on.

Create a source file as indicated by keydefined. This will describe all of the function keys and their hexidecimal format. The information data structure is used to return the hex values back to the calling program.

In the calling program, be sure to identify the infds(dspds) on the workstation file and place the copy statement in the data definition section of the program.


***** Non compliled source file *****
named: keydefined
library: mylibrary

* Get function key from data structure
d dspds ds
d fkey 369 369a
* Binary key definitions
d Enter s 1a inz(X'F1')
d PageUp s 1a inz(X'F4')
d PageDown s 1a inz(X'F5')
d Help s 1a inz(X'F3')
d Print s 1a inz(X'F6')
d Clear s 1a inz(X'FD')
d F1 s 1a inz(X'31')
d F2 s 1a inz(X'32')
d F3 s 1a inz(X'33')
d F4 s 1a inz(X'34')
d F5 s 1a inz(X'35')
d F6 s 1a inz(X'36')
d F7 s 1a inz(X'37')
d F8 s 1a inz(X'38')
d F9 s 1a inz(X'39')
d F10 s 1a inz(X'3A')
d F11 s 1a inz(X'3B')
d F12 s 1a inz(X'3C')
d F13 s 1a inz(X'B1')
d F14 s 1a inz(X'B2')
d F15 s 1a inz(X'B3')
d F16 s 1a inz(X'B4')
d F17 s 1a inz(X'B5')
d F18 s 1a inz(X'B6')
d F19 s 1a inz(X'B7')
d F20 s 1a inz(X'B8')
d F21 s 1a inz(X'B9')
d F22 s 1a inz(X'BA')
d F23 s 1a inz(X'BB')
d F24 s 1a inz(X'BC')

******* How used in program *********
* display file
fdsplyfile cf e workstn infds(dspds)
/copy mylibrary/src,keydefined
c if fkey=F3
c return
c endif

This was first published in April 2001

Dig deeper on iSeries CL programming

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close